#include <iostream>
#include <string>
#include <math.h>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <stack>
#include <bitset>
#define pb push_back
using namespace std;
void compile(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
int main(){
// compile();
int t = 1;
//cin >> t;
while(t--){
int n, x, y, z;
cin >> n >> x >> y >> z;
map<int,int>freq;
freq['&'] = x;
freq['|'] = y;
freq['^'] = z;
string a, b, s;
cin >> a >> b >> s;
map<int,vector<int>>mp, mp2;
for(int i = 0 ; i < n ; i++){
if(((a[i] - '0') & (b[i] - '0')) == s[i] - '0')mp[i].pb('&');
if(((a[i] - '0') ^ (b[i] - '0')) == s[i] - '0')mp[i].pb('^');
if(((a[i] - '0') | (b[i] - '0')) == s[i] - '0')mp[i].pb('|');
}
char c;
for(int i = 0 ; i < n ; i++){
if(mp[i].size() == 1){
if(freq[mp[i][0]] > 0){
mp2[i].pb(mp[i][0]);
c = mp[i][0];
freq[c]--;
}
}
}
bool f = 0;
for(int i = 0 ; i < n ; i++){
if(mp2[i].size() == 0 && mp[i].size() == 2){
char c;
int mx = -1;
for(int j = 0 ; j < mp[i].size() ; j++){
if(freq[mp[i][j]] > 0){
if(freq[mp[i][j]] > mx){
mx = freq[mp[i][j]];
c = mp[i][j];
}
}
}
if(mx != -1){
freq[c]--;
mp2[i].pb(c);
}
}
}
for(int i = 0 ; i < n ; i++){
if(mp2[i].size() == 0 && mp[i].size() == 3){
char c;
int mx = -1;
for(int j = 0 ; j < mp[i].size() ; j++){
if(freq[mp[i][j]] > 0){
if(freq[mp[i][j]] > mx){
mx = freq[mp[i][j]];
c = mp[i][j];
}
}
}
if(mx != -1){
freq[c]--;
mp2[i].pb(c);
}
}
}
for(int i = 0 ; i < n ; i++){
if(mp2[i].size() == 0)f = 1;
}
if(f){
puts("NO");
return 0;
}
puts("YES");
for(int i = 0 ; i < n ; i++){
printf("%c",mp2[i][0]);
}
puts("");
}
}
Copy