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>
#pragma comment(linker, "/STACK:66777216")
#pragma warning(disable : 4996)
#pragma hdrstop
using namespace std;
const int INF = 0x3f3f3f3f;
template <class T>
inline bool umin(T& a, const T& b) {
  return (b < a ? a = b, true : false);
}
class IO {
 public:
  static const int BUFFER_SIZE = 1 << 18;
  bool eof;
  char curChar;
  IO() : rbCount(0), rbOffset(0), curChar(0), eof(false) {}
  ~IO() { fwrite(writeBuffer, sizeof(writeBuffer[0]), wbOffset, stdout); }
  inline void nextString(char* s);
  IO& operator>>(char* s);
  void newline();
  void printString(const char* s);
  IO& operator<<(const char* s);
  IO& operator<<(ostream& (*fn)(ostream&));

 private:
  char readBuffer[BUFFER_SIZE], writeBuffer[BUFFER_SIZE];
  size_t rbCount, rbOffset, wbOffset;
};
extern bool useFastIO;
extern istream* pin;
extern ostream* pout;
extern IO io;
inline void nextString(char* s) {
  if (useFastIO) {
    io.nextString(s);
    return;
  }
  *pin >> s;
}
inline void newline() {
  if (useFastIO) {
    io.newline();
    return;
  }
  *pout << endl;
}
inline void printString(const char* s) {
  if (useFastIO) {
    io.printString(s);
    return;
  }
  *pout << s;
}
IO io;
const int MAXN = 111111;
struct Str {
  int cnt[255], ls;
  char s[MAXN];
  Str() {}
  void read() {
    io >> s;
    ls = strlen(s);
    memset(cnt, 0, sizeof(cnt));
    for (int i = 0; i < ls; ++i) {
      ++cnt[s[i]];
    }
  }
} a, b, c;
int cc;
char ans[MAXN];
void solve(istream& ins, ostream& out) {
  a.read();
  b.read();
  c.read();
  cc = 0;
  for (;;) {
    int mxa = INF, mxb = INF;
    for (int i = 'a'; i <= 'z'; ++i) {
      if (b.cnt[i]) {
        umin(mxa, a.cnt[i] / b.cnt[i]);
      }
    }
    for (int i = 'a'; i <= 'z'; ++i) {
      if (c.cnt[i]) {
        umin(mxb, a.cnt[i] / c.cnt[i]);
      }
    }
    if (!mxa && !mxb) {
      break;
    }
    Str& cur = (mxa < mxb ? c : b);
    for (int j = 0; j < cur.ls; ++j) {
      char ch = cur.s[j];
      ans[cc++] = cur.s[j];
      --a.cnt[ch];
    }
  }
  for (int i = 'a'; i <= 'z'; ++i) {
    for (int j = 0; j < a.cnt[i]; ++j) {
      ans[cc++] = i;
    }
  }
  ans[cc] = 0;
  io << ans << endl;
}
extern class IO io;
bool useFastIO = false;
istream* pin;
ostream* pout;
int main() {
  srand(time(NULL));
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  istream& in = cin;
  useFastIO = true;
  ostream& out = cout;
  out << fixed << setprecision(16);
  pin = &in;
  pout = &out;
  solve(in, out);
  return 0;
}
namespace Random {}
inline void IO::nextString(char* s) {
  if (!curChar) {
    rbCount =
        fread(readBuffer, sizeof(readBuffer[0]), sizeof(readBuffer), stdin);
    if (rbCount <= 0) {
      eof = true;
      return;
    }
    rbOffset = 0;
    curChar = readBuffer[rbOffset++];
  }
  while (!eof && (curChar == ' ' || curChar == '\n')) {
    if (rbOffset == rbCount) {
      rbCount =
          fread(readBuffer, sizeof(readBuffer[0]), sizeof(readBuffer), stdin);
      if (rbCount <= 0) {
        eof = true;
        return;
      }
      rbOffset = 0;
    }
    curChar = readBuffer[rbOffset++];
  }
  int ind = 0;
  while (!eof && curChar != ' ' && curChar != '\n') {
    s[ind++] = curChar;
    if (rbOffset == rbCount) {
      rbCount =
          fread(readBuffer, sizeof(readBuffer[0]), sizeof(readBuffer), stdin);
      if (rbCount <= 0) {
        eof = true;
        s[ind] = 0;
        return;
      }
      rbOffset = 0;
    }
    curChar = readBuffer[rbOffset++];
  }
  s[ind] = 0;
}
IO& IO::operator>>(char* s) {
  ::nextString(s);
  return *this;
}
void IO::newline() {
  if (wbOffset == BUFFER_SIZE) {
    fwrite(writeBuffer, sizeof(writeBuffer[0]), wbOffset, stdout);
    wbOffset = 0;
  }
  writeBuffer[wbOffset++] = '\n';
}
void IO::printString(const char* s) {
  for (int i = 0; s[i]; ++i) {
    if (wbOffset == BUFFER_SIZE) {
      fwrite(writeBuffer, sizeof(writeBuffer[0]), wbOffset, stdout);
      wbOffset = 0;
    }
    writeBuffer[wbOffset++] = s[i];
  }
}
IO& IO::operator<<(const char* s) {
  ::printString(s);
  return *this;
}
IO& IO::operator<<(ostream& (*fn)(ostream&)) {
  ::newline();
  return *this;
}
