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

#include <bits/stdc++.h>
using namespace std;
int cnt[3][30], len[3], new_cnt[30], result[2][2];
char line[3][100005];
int n;
int main(void) {
  while (NULL != fgets(line[0], sizeof(line[0]), stdin)) {
    fgets(line[1], sizeof(line[1]), stdin);
    fgets(line[2], sizeof(line[2]), stdin);
    memset(result, 0, sizeof(result));
    for (int i = 0; i < 3; i++) {
      memset(cnt[i], 0, sizeof(cnt[i]));
      len[i] = strlen(line[i]);
      line[i][len[i] - 1] = '\0';
      len[i]--;
      for (int j = 0; j < len[i]; j++) {
        cnt[i][line[i][j] - 'a']++;
      }
    }
    for (int i = 1; i < 3; i++) {
      for (int j = 0; j < 26; j++) {
        new_cnt[j] = cnt[0][j];
      }
      int tmp_cnt = 1e9;
      for (int j = 0; j < 26; j++) {
        if (new_cnt[j] < cnt[i][j]) {
          tmp_cnt = 1e9;
          break;
        } else if (cnt[i][j] != 0) {
          tmp_cnt = min(tmp_cnt, new_cnt[j] / cnt[i][j]);
        }
      }
      if (tmp_cnt != 1e9) {
        for (int j = 0; j < 26; j++) {
          new_cnt[j] -= cnt[i][j] * tmp_cnt;
        }
        result[i - 1][0] = tmp_cnt;
      }
      tmp_cnt = 1e9;
      for (int j = 0; j < 26; j++) {
        if (new_cnt[j] < cnt[3 - i][j]) {
          tmp_cnt = 1e9;
          break;
        } else if (cnt[3 - i][j] != 0) {
          tmp_cnt = min(tmp_cnt, new_cnt[j] / cnt[3 - i][j]);
        }
      }
      if (tmp_cnt != 1e9) {
        for (int j = 0; j < 26; j++) {
          new_cnt[j] -= cnt[3 - i][j] * tmp_cnt;
        }
        result[i - 1][1] = tmp_cnt;
      }
      if (i == 2) {
        int tmp = result[i - 1][0];
        result[i - 1][0] = result[i - 1][1];
        result[i - 1][1] = tmp;
      }
    }
    int max_index;
    if (result[0][0] + result[0][1] > result[1][0] + result[1][1])
      max_index = 0;
    else
      max_index = 1;
    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < result[max_index][i]; j++) {
        printf("%s", line[i + 1]);
      }
      for (int k = 0; k < 26; k++) {
        cnt[0][k] -= cnt[i + 1][k] * result[max_index][i];
      }
    }
    for (int i = 0; i < 26; i++) {
      while (cnt[0][i] > 0) {
        cnt[0][i]--;
        putchar('a' + i);
      }
    }
    putchar('\n');
  }
  return 0;
}
