CSES - HIIT Open 2017 - Median string
  • Time limit: 1.00 s
  • Memory limit: 512 MB

Let d(a,b)d(a,b) denote the edit distance between strings aa and bb, which is the minimum number of editing operations needed to transform aa into bb. The allowed editing operations are as follows:

  • add one character
  • remove one character
  • change one character

For example, d(AABA,CAA)=2d(\texttt{AABA},\texttt{CAA})=2, because we can remove the B\texttt{B} letter and change the first A\texttt{A} letter.

Given three strings aa, bb and cc, your task is to find a string xx such that d(x,a)+d(x,b)+d(x,c)d(x,a)+d(x,b)+d(x,c) is minimum.

Input

There are three lines that contain the strings aa, bb and cc. Each string consists of characters AZ\texttt{A} \ldots \texttt{Z}.

Output

Print a string xx that consists of characters AZ\texttt{A} \ldots \texttt{Z} and minimizes the edit distance. If there are several such strings, print any of them.

Constraints

  • 1a,b,c501 \le |a|, |b|, |c| \le 50

Example

Input:

ABBA
AYBABTU
BASTU

Output:

ABABTU