Problem: Problem Statement

You bought 3 ancient scrolls from a magician. These scrolls have a long string, and the lengths of the strings are the same. He said that these scrolls are copies of the key string to enter a dungeon with a secret treasure. However, he also said, they were copied so many times by hand, so the string will contain some errors, though the length seems correct.

Your job is to recover the original string from these strings. When finding the original string, you decided to use the following assumption.

* The copied string will contain at most d errors. In other words, the Hamming distance of the original string and the copied string is at most d.
* If there exist many candidates, the lexicographically minimum string is the original string.



Can you find the orignal string?



Input

The input contains a series of datasets.

Each dataset has the following format:


l d
str_1
str_2
str_3


The first line contains two integers l (1 \leq l \leq 100,000) and d (0 \leq d \leq 5,000.) l describes the length of 3 given strings and d describes acceptable maximal Hamming distance. The following 3 lines have given strings, whose lengths are l. These 3 strings consist of only lower and upper case alphabets.

The input ends with a line containing two zeros, which should not be processed.

Output

Print the lexicographically minimum satisfying the condition in a line. If there do not exist such strings, print `-1`.

Example

Input

3 1
ACM
IBM
ICM
5 2
iwzwz
iziwi
zwizi
1 0
A
B
C
10 5
jLRNlNyGWx
yyLnlyyGDA
yLRnvyyGDA
0 0


Output

ICM
iwiwi
-1
AARAlNyGDA

Solution (in CPP):

Solution:
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
#include <complex>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
string A,B,C;
int type(int i){
	if(A[i]==B[i]&&B[i]==C[i]) return 4;
	if(B[i]==C[i]) return 0;
	if(C[i]==A[i]) return 1;
	if(A[i]==B[i]) return 2;
	return 3;
}
int main(){
	while(true){
		int N,d;
		cin>>N>>d;
		if(N==0) break;
		cin>>A>>B>>C;
		int a=d,b=d,c=d;
		int t[5]={};
		string ans;
		rep(i,N) t[type(i)]++;
		rep(i,N){
			vector<char> cand;
			cand.pb(A[i]);
			cand.pb(B[i]);
			cand.pb(C[i]);
			cand.pb('A');
			sort(all(cand));
			t[type(i)]--;
			for(char ch:cand){
				int l[3]={a,b,c};
				if(ch!=A[i]) l[0]--;
				if(ch!=B[i]) l[1]--;
				if(ch!=C[i]) l[2]--;
				bool hoge=true;
				rep(j,3) if(l[j]<0) hoge=false;
				if(!hoge) continue;
				int nt[5];
				rep(j,5) nt[j]=t[j];
				rep(j,3){
					if(l[j]<nt[j]) nt[j]-=l[j],l[j]=0;
					else l[j]-=nt[j],nt[j]=0;
				}
				l[0]-=nt[1]+nt[2];
				l[1]-=nt[2]+nt[0];
				l[2]-=nt[0]+nt[1];
				bool can=true;
				rep(j,3) if(l[j]<0) can=0;
				if(l[0]+l[1]+l[2]<2*nt[3]) can=0;
				int h=0;
				rep(j,3) h+=max(0,l[j]-nt[3]);
				if(h>l[0]+l[1]+l[2]-2*nt[3]) can=0;
				if(can){
					ans+=ch;
					if(ch!=A[i]) a--;
					if(ch!=B[i]) b--;
					if(ch!=C[i]) c--;
					break;
				}
			}
			if(ans.size()==0){
				ans="-1";
				break;
			}
		}
		cout<<ans<<endl;
	}
}