#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
if(!(cin >> N)) return 0;
string SS, SK, SH;
cin >> SS >> SK >> SH;
vector<int> idxC, idxBKH, idxBSH;
idxC.reserve(N); idxBKH.reserve(N); idxBSH.reserve(N);
for (int i = 0; i < N; ++i) {
char a = SS[i], b = SK[i], c = SH[i];
if (a == b && b == c) {
// A형: 모두 같음 -> 건너뜀(아무도 점수 안 주는 문자로 처리)
} else if (a == b && b != c) {
// B_SK형: S=K!=H (이번 구성에선 사용 안 함)
} else if (a == c && c != b) {
// B_SH형: S=H!=K -> K-only 가능
idxBSH.push_back(i);
} else if (b == c && c != a) {
// B_KH형: K=H!=S -> S-only 가능
idxBKH.push_back(i);
} else {
// C형: 모두 다름 -> S-only도 K-only도 가능(하지만 1자리는 1회만 사용)
idxC.push_back(i);
}
}
// 필요 수량
int needS = 2; // S-only 최소 2
int needK = 1; // K-only 최소 1
// 먼저 B_KH로 S-only 충당
int takeS_from_BKH = min(needS, (int)idxBKH.size());
needS -= takeS_from_BKH;
// B_SH로 K-only 충당
int takeK_from_BSH = min(needK, (int)idxBSH.size());
needK -= takeK_from_BSH;
// 남은 수량은 C형에서 충당해야 함(서로 다른 인덱스로)
if ((int)idxC.size() < needS + needK) {
cout << -1 << "\n";
return 0;
}
// ---- 구성 시작 ----
string S(N, 'a');
// 우선 아무도 맞지 않게 각 자리마다 3글자와 다른 문자를 넣는다
for (int i = 0; i < N; ++i) {
char a = SS[i], b = SK[i], c = SH[i];
char pick = 'a';
if (pick == a || pick == b || pick == c) {
for (char ch = 'a'; ch <= 'z'; ++ch) {
if (ch != a && ch != b && ch != c) {
pick = ch;
break;
}
}
}
// 항상 존재(최대 3글자만 금지)
S[i] = pick;
}
vector<char> used(N, 0);
// S-only: 먼저 B_KH에서 사용
vector<int> usedS, usedK;
for (int i = 0; i < takeS_from_BKH; ++i) {
int p = idxBKH[i];
S[p] = SS[p]; // S만 +1
used[p] = 1;
usedS.push_back(p);
}
// K-only: B_SH에서 사용
for (int i = 0; i < takeK_from_BSH; ++i) {
int p = idxBSH[i];
S[p] = SK[p]; // K만 +1
used[p] = 1;
usedK.push_back(p);
}
// 남은 S-only를 C형에서 확보
int ci = 0;
while (needS > 0 && ci < (int)idxC.size()) {
int p = idxC[ci++];
if (used[p]) continue;
S[p] = SS[p]; // S만 +1
used[p] = 1;
usedS.push_back(p);
--needS;
}
// 남은 K-only를 C형에서 확보 (S-only로 쓴 C형과 겹치지 않게)
while (needK > 0 && ci < (int)idxC.size()) {
int p = idxC[ci++];
if (used[p]) continue;
S[p] = SK[p]; // K만 +1
used[p] = 1;
usedK.push_back(p);
--needK;
}
// 혹시 남았으면 더 찾아본다(이론상 위 체크로 여기 올 일 없음)
for (; needS > 0 && ci < (int)idxC.size(); ++ci) {
int p = idxC[ci];
if (used[p]) continue;
S[p] = SS[p];
used[p] = 1;
--needS;
}
for (; needK > 0 && ci < (int)idxC.size(); ++ci) {
int p = idxC[ci];
if (used[p]) continue;
S[p] = SK[p];
used[p] = 1;
--needK;
}
if (needS > 0 || needK > 0) {
cout << -1 << "\n";
return 0;
}
cout << S << "\n";
return 0;
}