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<stdio.h>
#include<algorithm>
using namespace std;
char A[110000];
char B[110000];
char C[110000];
char ret[110000];
int c[5];
int d[3];
int e[3];
int chk(){
	for(int i=0;i<3;i++)e[i]=d[i];
	int rem=c[1];
	int tmp=min(rem,e[2]);
	rem-=tmp;e[2]-=tmp;
	e[0]-=rem;e[1]-=rem;
	if(e[0]<0||e[1]<0)return 0;
	rem=c[2];
	tmp=min(rem,e[1]);
	rem-=tmp;e[1]-=tmp;
	e[0]-=rem;e[2]-=rem;
	if(e[0]<0||e[2]<0)return 0;
	rem=c[3];
	tmp=min(rem,e[0]);
	rem-=tmp;e[0]-=tmp;
	e[2]-=rem;e[1]-=rem;
	if(e[2]<0||e[1]<0)return 0;
	int mv=max(e[0],max(e[1],e[2]));
	int sum=e[0]+e[1]+e[2];
	int can=min(sum-mv,sum/2);
	if(can<c[4])return 0;
	return 1;
}
char ko[5];
int ty[110000];
int main(){
	int a,b;
	while(scanf("%d%d",&a,&b),a){
		scanf("%s%s%s",A,B,C);
		for(int i=0;i<5;i++)c[i]=0;
		for(int i=0;i<a;i++){
			if(A[i]==B[i]&&B[i]==C[i])ty[i]=0;
			else if(A[i]==B[i])ty[i]=1;
			else if(A[i]==C[i])ty[i]=2;
			else if(C[i]==B[i])ty[i]=3;
			else ty[i]=4;
			c[ty[i]]++;
		}
	//	for(int i=0;i<5;i++)printf("%d ",c[i]);
		for(int i=0;i<3;i++)d[i]=b;
		if(!chk()){
			printf("-1\n");continue;
		}
		ret[a]=0;
		for(int i=0;i<a;i++){
			c[ty[i]]--;
			ko[0]='A';ko[1]=A[i];ko[2]=B[i];ko[3]=C[i];
			std::sort(ko,ko+4);
			for(int j=0;j<4;j++){
				if(A[i]!=ko[j])d[0]--;
				if(B[i]!=ko[j])d[1]--;
				if(C[i]!=ko[j])d[2]--;
				if(chk()){ret[i]=ko[j];break;}
				if(A[i]!=ko[j])d[0]++;
				if(B[i]!=ko[j])d[1]++;
				if(C[i]!=ko[j])d[2]++;
			}
		}
		printf("%s\n",ret);
	}
}