#define _CRT_SECURE_NO_WARNINGS
#include <utility>
#include <string.h>
#include <string>
#include <math.h>
#include <stack>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <iterator>
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <bitset>
#include <time.h>
#include <stdlib.h>
using namespace std;
const long long INF = 1ll << 32;
const double PI = acos(-1);
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef pair<int, int>pi;
typedef pair<ll, ll>pl;
typedef vector<pi>vpi;
typedef vector<pl>vpl;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vl> vvl;
typedef vector<string> vs;
int dc[] = { 0,0,1,-1 }, dr[] = { 1,-1,0,0 };
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define read(v) for (int it = 0; it < v.size(); it++) {scanf("%d", &v[it]);}
#define print(v) for(auto it : v) printf("%d ", it); puts("");
#define readL(v) for (int it = 0; it < v.size(); it++) scanf("%lld", &v[it]);
#define printL(v) for (auto it : v) printf("%lld ", it); puts("");
#define readC(v) for (int it = 0; it < v.size(); it++) {scanf("%c", &v[it]);}
#define printC(v) for(auto it : v) printf("%c", it); puts("");
void build() {
}
void solve() {
int n, x, y, z;
scanf("%d %d %d %d", &n, &x, &y, &z);
vector <char> ans(n,'?');
string a, b, c;
cin >> a >> b >> c;
for (int i = 0; i < n; i++) {
if (a[i] == '1' && b[i] == '1' && c[i] == '0') {
if (!z) {
puts("NO");
return;
}
z--;
ans[i] = '^';
}
else if (a[i] == '1' && b[i] == '0' && c[i] == '0') {
if (!x) {
puts("NO");
return;
}
x--;
ans[i] = '&';
}
else if (a[i] == '0' && b[i] == '1' && c[i] == '0') {
if (!x) {
puts("NO");
return;
}
x--;
ans[i] = '&';
}
}
for (int i = 0; i < n; i++) {
if (ans[i] != '?')
continue;
if (a[i] == '1' && b[i] == '0' && c[i] == '1') {
if (y) {
ans[i] = '|';
y--;
}
else if (z) {
z--;
ans[i] = '^';
}
else {
puts("NO");
return;
}
}
else if (a[i] == '0' && b[i] == '1' && c[i] == '1') {
if (y) {
ans[i] = '|';
y--;
}
else if (z) {
z--;
ans[i] = '^';
}
else {
puts("NO");
return;
}
}
else if (a[i] == '1' && b[i] == '1' && c[i] == '1') {
if (x) {
x--;
ans[i] = '&';
}
else if (y) {
ans[i] = '|';
y--;
}
else {
puts("NO");
return;
}
}
else if (a[i]=='0'&&b[i]=='0'&&c[i]=='0') {
if (x) {
x--;
ans[i] = '&';
}
else if (y) {
ans[i] = '|';
y--;
}
else if (z) {
z--;
ans[i] = '^';
}
else {
puts("NO");
return;
}
}
else {
puts("NO");
return;
}
}
puts("YES");
printC(ans);
}
int main(void) {
int t = 1;
//scanf("%d", &t);
build();
while (t--)
solve();
return 0;
}
Copy