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 <bits/stdc++.h>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define chmax(a,b) (a<(b)?(a=b,1):0)
#define chmin(a,b) (a>(b)?(a=b,1):0)
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
const int INF = 1<<29;
const double EPS = 1e-8;
const double PI = acos(-1);
typedef pair<int,int> pii;
typedef long long ll;


char str[3][100001];
char ans[100001];

bool check(int pair[3], int dist, int same, int dif[3]) {
  // cout << "pair : "; REP(i,3) cout << pair[i] << ","; cout << endl;
  // cout << "dist : " << dist << endl;
  // cout << "same : " << same << endl;
  // cout << "dif : "; REP(i,3) cout << dif[i] << ","; cout << endl;
  int u[3];
  int sum = 0;
  REP(i,3) {
    // dist-x<=dif[i]-pair[i]
    // x >= dist  - (dif[i]-pair[i])
    u[i] = max(0, dist-(dif[i]-pair[i]));
    sum += u[i];
  }
  if (sum<=dist) return 1;
  REP(i,3) {
    int j = (i+1)%3;
    int k = (i+2)%3;
    if (u[j]==0 && u[k]==0) {
      int r = min(pair[i], min(dif[j]-pair[j]-dist, dif[k]-pair[k]-dist));
      if (sum-r <= dist) return 1;
    }
  }
  return 0;
}

int main() {
  int l,d;
  while(cin >> l >> d, l||d) {
    int pair[3] = {};
    int dist = 0;
    int same = 0;
    REP(i,3) scanf("%s",str[i]);
    REP(i,l) {
      char c[3] = {str[0][i],str[1][i],str[2][i]};
      if (c[0]==c[1]&&c[1]==c[2]) {
        same++;
      } else {
        bool ok = 0;
        REP(j,3) {
          if (c[(j+1)%3]==c[(j+2)%3]) {
            ok = 1;
            pair[j]++;
          }
        }
        if (!ok) {
          dist++;
        }
      }
    }

    bool ok = 0;
    int dif[3] = {d,d,d};
    REP(i,l) {
      char c[3] = {str[0][i],str[1][i],str[2][i]};
      char cand[4] = {'A',c[0],c[1],c[2]};
      sort(cand,cand+4);
      
      if (c[0]==c[1]&&c[1]==c[2]) {
        same--;
      } else {
        bool ok = 0;
        REP(j,3) {
          if (c[(j+1)%3]==c[(j+2)%3]) {
            ok = 1;
            pair[j]--;
          }
        }
        if (!ok) {
          dist--;
        }
      }

      ok = 0;
      REP(j,4) {
        REP(k,3) {
          if (c[k]!=cand[j]) {
            dif[k]--;
          }
        }

        if (check(pair,dist,same,dif)) {
          ans[i] = cand[j];
          ok = 1;
          break;
        }
        
        REP(k,3) {
          if (c[k]!=cand[j]) {
            dif[k]++;
          }
        }
        
      }
      if (!ok) break;
    }
    if (!ok) cout << -1 << endl;
    else {
      ans[l] = 0;
      cout << ans << endl;
    }
  }
}