program project1;
type szam = array[1..6] of string;
  var a,b,c:string;
      num:szam;
      s:string;
      i,j,k,max:byte;
      bool:boolean;
begin
  readln(s);
  s:=s+' ';

  i := pos(' ',s);
  a := copy(s,1,i-1);
  delete(s,1,i);

  i := pos(' ',s);
  b := copy(s,1,i-1);
  delete(s,1,i);

  i := pos(' ',s);
  c := copy(s,1,i-1);
  delete(s,1,i);
  max:=length(a)+length(b)+length(c);


  num[1]:=a+b+c;
  num[2]:=a+c+b;
  num[3]:=b+a+c;
  num[4]:=b+c+a;
  num[5]:=c+a+b;
  num[6]:=c+b+a;
  bool:=false;

  i:=0;
  repeat
      for j:=1 to 6 do
          for k:=j+1 to 6 do
          begin
            if (num[j]<>'u')and(num[k]<>'u') then
                  if num[j][i] <> num[k][i] then
                     if num[j][i] > num[k][i] then
                        num[k]:='u'
                     else if num[j][i]<num[k][i] then
                          num[j]:='u';
          end;
   i:=i+1;
  until (i = max);

  for i:=1 to 6 do
      for j:=i+1 to 6 do
         if (num[i]<>'u') and (num[j]=num[i]) then num[j]:='u';
  for i:=1 to 6 do if num[i]<>'u' then writeln(num[i]);
  readln;

end.