import std.stdio,std.conv,std.string,std.algorithm,std.range;

void main(){
    auto inp=readln.chomp.split.to!(ulong[]);
    auto x=inp[0];
    auto y=inp[1];
    auto p=readln.chomp.split.to!(ulong[]);
    auto q=readln.chomp.split.to!(ulong[]);
    auto r=readln.chomp.split.to!(ulong[]);
    p.sort;
    q.sort;
    r.sort;
    auto red=x>0?p[$-x..$]:[];
    auto green=y>0?q[$-y..$]:[];
    bool flag;
    while(true){
        flag=false;
        if(r.length==0)
            break;
        else{
            if(red[0]>green[0]){
                if(green[0]<=r[$-1]){
                    green=green[1..$]~r[$-1];
                    r=r[0..$-1];
                    flag=true;
                }
            }else{
                if(red[0]<=r[$-1]){
                    red=red[1..$]~r[$-1];
                    r=r[0..$-1];
                    flag=true;
                }
            }
        }
        if(!flag)
            break;
    }   
    (red.fold!"a+b"+green.fold!"a+b").writeln;
}