String Minimization
a尽可能小的话,如果能和c交换更小就交换。
如果a和c相等,b交换能更小,就交换b。
#include <bits/stdc++.h>
//#define int long long
#define per(i,j,k) for(int (i)=(j);(i)<=(k);++(i))
#define rep(i,j,k) for(int (i)=(j);(i)>=(k);--(i))
#define debug(a) cout<<#a<<"="<<a<<endl
#define all(x) x.begin(),x.end()
#define fr first
#define se second
#define endl '\n'
using namespace std;void solve(){string a,b,c,d;cin>>a>>a>>b>>c>>d;per(i,0,a.length()-1){if(c[i]<a[i]){swap(c[i],a[i]);swap(b[i],d[i]);}else if(c[i]==a[i]){if(d[i]<b[i])swap(d[i],b[i]);}}cout<<b<<endl;
}signed main(){ios::sync_with_stdio(false),cin.tie(nullptr);int t=1;while(t--)solve();return 0;
}