brtakoktrosttttttttttosafasfkalsfkodfdasiofhadfhasdsajfdsafoasodsafahaihfdisoadspapsapiosapdsajdipsahdhasuirhaeuifhhfkjgosooooooooodafdfioottttafdsafaddfuiasdjfjasdo
okat
tako
 aleksandrehteosidatedodam
evo
si
 goodbyeihopecontestisntsohar
oh
god
 duxidimkeetoivas
dd
odi
 hellodeninobrdo
od
hel
 ikbalturkeybelieveinyou
bal
kan
 zdule
didins
meinkraft
 cumurcumur
um
cur
 ikatanictisinajboljiuhrvatskojakoprictasovojaviseakotijedosadno
javise
sine
 zlobobermyfriendandthanksforhelp
de
for
 navijamzaradnickiastabidrugo
druzina
djavola
 saljivdzijasamjaneki
neki
ja
 bumbumdzejsikerol
bumbum
bum
 svetislavgajicpoznatijikaosvetaxxx
slavi
slavu
 princeofpersiayouhavegreatcontestbutinwrongtime
op
pera
 pozdravizamarkamatovicaaleksandracveticainenadaslagalicustanisica
vas
rad
 dreamoonhasonedream
no
no
 jankosustersicneceovoraditi
cosovic
oce
 milenicnikolaitisideotakmicenja
elem
nik
 touristyouaregreatguy
tourist
guy
 lukavpastaakojelukav
a
u
 xxxbbbcccoca
ca
cb
 aaaaaabababaaa
aa
a
 petryouaregoodandyouhavegoodblogs
blog
rega
 lebronnojameslebronprogrammers
je
bro
 mztskopjetisisampiosrcenaterenostaviajdezanaspobedi
mzt
optee
 gukimikazedauradimseminarskidodatnohumorhumor
dp
mrzime
 razredninjegosgrebovicdobarcoveklosbasketas
ne
go
 pozdravzamojeodeljenjeiprofesoreocudabudempetnula
bojan
cao
 damandicnenapravicheckerzeznulibise
man
ker
 pozdravizazenskudecunecuvasodvajatidaseneprotumacipogresno
cao
deco
 egoryouaregoodbutcantsolveeverythinginonehour
eat
your
 lemigazalemiolemilicomzalemljenje
lemi
zlo
 randomusername
umno
umno
 thisiscornercase
youhavetwolongerstrings
ibelivethatyoudontmissit
 oduleodule
xgrizx
ivanstosicprvi
 molimprofesorkuengleskogdamidapetjasamdobarcovekitrudimseiztogaiakosamoperisan
hvala
unapred
 djeneralmilomirstefanovic
radi
nesto
 balsabratepozdravimajudevojku
oj
zdrav
 iwanttothanktomygrandmaheisveryimportantpersoninmylife
thanks
stanka

takotakotakotakotakoaaaaaaaaaaaaaaaaaaaaaabddddddddddddddddddeffffffffffffffffffghhhhhhhhhiiiiiiiiijjjjjloooooooooooooooooppppprrrssssssssssssssssssssstttttttttttuuu
 siaaaaddddeeeehklmnoorstt
 ohohgodabceeeiinnooprsssttty
 odiadeeiikmstuvx
 ododhelbeilnnor
 kanbbeeeeiiikllortuuvyy
 deluz
 umumcurcur
 sinesineaaaaaaaaabccddhiiiiiijjjjjkkkklnooooooooprrssstttttuvvv
 dedeforforaabbehhikllmnnnoprstyz
 druzinaaaaaabcdgiiijkmnorstv
 nekijajajaadiilmssvz
 bumbumdeeijklorsz
 slaviaaaaceegiiijjknoopsstttvvxxxz
 peraperaabcceeeefgghiiiimnnnnoooorrsstttttuuvwy
 vasvasvasradradradaaaaaaaaaaccccceeegiiiiiiikklllmmnnnnoopstttuzz
 nonoaaaddeeehmmorrs
 oceoceaadeiiijknnorrsssttuv
 elemniknikaaaccdeiiiiijlmnoostt
 touristguyguyaaeeorrt
 aaaaauuejkkkllopstvv
 cacbcbcboxxx
 aaaaaaaaaaabbb
 blogregaregaadddehnoooooopstuuvyy
 jebrobroaaeeegllmmmnnnooprrrss
 mztopteeopteeopteeaaaaaabcddiiiiijjkmnnnorrssssssvz
 mrzimeaaaaaddddeghhiiiikkkmmmnnoooorrrsstuuuu
 nenegogoaaaabbbccddeeeiijkklooorrrrsssstvvz
 bojancaoaaddddeeeeeeeefijjllmmnooooppprrrstuuuvzz
 mankeraaabcccddeeeehiiiilnnnprsuvzz
 decodecodecoaaaaaaadeeegiiijkmnnnnooppprrrssssttuuuuvvvzzz
 eateatyouryourbcdeeeeggghhiilnnnnooooorrstuvv
 lemilemilemilemizlozloaaaceegjjmn
 umnoaadeemnrrs
 acceehiinorrssst
 ddeelloouu
 unapredunapredaaaaaaabcddeeeeefgggiiiiiiijkkkkllmmmmmmoooooooooprrrsssssstttvz
 radinestoaceefiijllmmnorv
 ojojzdravaaaabbdeeiklmprstuuv
 stankaaaadeeeefghhiiiiilmmmmnnnnnoooopprrrrstttttvwyyy

import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author K0T
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskB {

    public void solve(int testNumber, InputReader scn, PrintWriter pw) {
        String a = scn.next();
        String b = scn.next();
        String c = scn.next();
        int[] cnt = new int[30];
        Arrays.fill(cnt, 0);
        for (int i = 0; i < a.length(); i++) {
            int code = (int)a.charAt(i) - (int)('a');
            cnt[code]++;
        }
        int fb, fc;
        fb = fc = 0;
        int[] nb = new int[30];
        int[] nc = new int[30];
        Arrays.fill(nb, 0);
        Arrays.fill(nc, 0);
        for (int i = 0; i < b.length(); i++) {
            int code = (int)b.charAt(i) - (int)('a');
            nb[code]++;
        }
        for (int i = 0; i < c.length(); i++) {
            int code = (int)c.charAt(i) - (int)('a');
            nc[code]++;
        }
        int f = get(cnt, nb, nc);
        Arrays.fill(nb, 0);
        Arrays.fill(nc, 0);
        for (int i = 0; i < b.length(); i++) {
            int code = (int)b.charAt(i) - (int)('a');
            nb[code]++;
        }
        for (int i = 0; i < c.length(); i++) {
            int code = (int)c.charAt(i) - (int)('a');
            nc[code]++;
        }
        Arrays.fill(cnt, 0);
        for (int i = 0; i < a.length(); i++) {
            int code = (int)a.charAt(i) - (int)('a');
            cnt[code]++;
        }
        int ff = get(cnt, nc, nb);
        if (ff > f) {
            String d = b;
            b = c;
            c = d;
            for (int i = 0; i < 26; i++) {
                int x = nb[i];
                nb[i] = nc[i];
                nc[i] = x;
            }
        }
        Arrays.fill(nb, 0);
        Arrays.fill(nc, 0);
        for (int i = 0; i < b.length(); i++) {
            int code = (int)b.charAt(i) - (int)('a');
            nb[code]++;
        }
        for (int i = 0; i < c.length(); i++) {
            int code = (int)c.charAt(i) - (int)('a');
            nc[code]++;
        }
        Arrays.fill(cnt, 0);
        for (int i = 0; i < a.length(); i++) {
            int code = (int)a.charAt(i) - (int)('a');
            cnt[code]++;
        }
        while (true) {
            boolean can = true;
            for (int i = 0; i < 26; i++) {
                if (cnt[i] - nb[i] < 0) {
                    can = false;
                    break;
                }
            }
            if (can == false) {
                break;
            }
            for (int i = 0; i < 26; i++) {
                cnt[i] -= nb[i];
            }
            pw.print(b);
        }
        while (true) {
            boolean can = true;
            for (int i = 0; i < 26; i++) {
                if (cnt[i] - nc[i] < 0) {
                    can = false;
                    break;
                }
            }
            if (can == false) {
                break;
            }
            for (int i = 0; i < 26; i++) {
                cnt[i] -= nc[i];
            }
            pw.print(c);
        }
        for (int i = 0; i < 26; i++) {
            char sym = (char)(i + (int)('a'));
            for (int j = 0;j < cnt[i]; j++) pw.print(sym);
        }
        pw.println("");
    }

    private int get(int[] cnt, int[] nb, int[] nc) {
        int res = 0;
        while (true) {
            boolean can = true;
            for (int i = 0; i < 26; i++) {
                if (cnt[i] - nb[i] < 0) {
                    can = false;
                    break;
                }
            }
            if (can == false) {
                break;
            }
            for (int i = 0; i < 26; i++) {
                cnt[i] -= nb[i];
            }
            ++res;
        }while (true) {
            boolean can = true;
            for (int i = 0; i < 26; i++) {
                if (cnt[i] - nb[i] < 0) {
                    can = false;
                    break;
                }
            }
            if (can == false) {
                break;
            }
            for (int i = 0; i < 26; i++) {
                cnt[i] -= nc[i];
            }
            ++res;
        }
        return res;
    }

}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

}
