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.InputStream;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.Stream;


public class Problem307B {
	
	private static Map<Character, Integer> getCharCounts(String s) {
		final Map<Character, Integer> res = new HashMap<Character, Integer>();
		for(char c : s.toCharArray()) {
			res.put(c, res.containsKey(c) ? res.get(c) + 1 : 1);
		};
		return res;
	}
	
	private static int getFullInclutions(Map<Character, Integer> aCnts, Map<Character, Integer> xCnts) {
		int res = 0;
		for(char c : xCnts.keySet()) {
			res = (aCnts.containsKey(c) ? aCnts.get(c) : 0) / xCnts.get(c);
			if (res == 0) break;
		}
		return res;
	}
	
	private static double getFullInclutionsDbl(Map<Character, Integer> aCnts, Map<Character, Integer> xCnts) {
		double res = 0d;
		for(char c : xCnts.keySet()) {
			res = (aCnts.containsKey(c) ? ((double)aCnts.get(c)) : 0d) / xCnts.get(c);
			if (res == 0d) break;
		}
		return res;
	}
	
	private static  Map<Character, Integer> substruct(Map<Character, Integer> aCnts, Map<Character, Integer> xCnts) {
		Map<Character, Integer> res = new HashMap<Character, Integer>(aCnts);
		for(char c : xCnts.keySet()) {
			res.put(c, aCnts.get(c) - xCnts.get(c));
		}
		return res;
	}
	
	public static void implementation(InputStream in, PrintStream out) throws Exception {
		StringBuilder sb = new StringBuilder();
		Scanner s = new Scanner(in);
		String a = s.nextLine();	
		String b = s.nextLine();
		String c = s.nextLine();
		
		Map<Character, Integer> aCnts = getCharCounts(a);
		Map<Character, Integer> bCnts = getCharCounts(b);
		Map<Character, Integer> cCnts = getCharCounts(c);
		int gfiB, gfiC;
		while((gfiB = getFullInclutions(aCnts, bCnts)) + (gfiC = getFullInclutions(aCnts, cCnts)) > 0) {
			int bVoteNum = 0;
			int cVoteNum = 0;
			Map<Character, Integer> aBCnts = null;
			Map<Character, Integer> aCCnts = null;
			if (gfiB > 0) {
				aBCnts = substruct(aCnts, bCnts);
				bVoteNum = getFullInclutions(aBCnts, bCnts) + getFullInclutions(aBCnts, cCnts);
			}
			if (gfiC > 0) {
				aCCnts = substruct(aCnts, cCnts);
				cVoteNum = getFullInclutions(aCCnts, bCnts) + getFullInclutions(aCCnts, cCnts);
			}
			
			Boolean bWins = null;
			if (gfiB > 0 && gfiC > 0 && bVoteNum == cVoteNum) {
				
				Map<Character, Integer> bbCnts = new HashMap<Character, Integer>(bCnts);
				Map<Character, Integer> ccCnts = new HashMap<Character, Integer>(cCnts);
				
				
				Map<Character, Integer> commonCnts = new HashMap<Character, Integer>(aCnts);
				for(char ch : aCnts.keySet()) {
					if (!(bCnts.containsKey(ch) && cCnts.containsKey(ch))) {
						commonCnts.remove(ch);
						bbCnts.remove(ch);
						ccCnts.remove(ch);
					}
				}
	
				
				bWins = getFullInclutionsDbl(commonCnts, bbCnts) > getFullInclutions(commonCnts, ccCnts);
			}
			
			bWins = (bWins == null) ? (gfiB > 0 && bVoteNum > cVoteNum || gfiC == 0) : bWins;
			
			if (bWins) {
				sb.append(b);
				aCnts = aBCnts;
			} else {
				sb.append(c);
				aCnts = aCCnts;
			}
		}
		for(char ch : aCnts.keySet()) {
			int cnt = aCnts.get(ch);
			Stream.iterate(1, i -> i + 1).limit(cnt).forEach(i -> sb.append(ch) );
		}
		out.print(sb.toString());
	}

	public static void main(String[] args) throws Exception {
		implementation(System.in, System.out);
	}
	
}
