import java.*;
import java.io.*;
//import java.util.HashSet;
//import java.util.Map;
import java.util.*;

public class declare {

private static BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
//private static StreamTokenizer t = new StreamTokenizer(r);

private static String s1;
private static String s2;
private static String w1;
private static String w2;
private static Set<String> allWords = new HashSet<String>();
private static List<String> l1 = new ArrayList<String>();
private static List<String> l2 = new ArrayList<String>();

private static void vypis(String w) {
	System.out.print(w+" ");
}

static void parseInput() throws Exception {	
	s1 = r.readLine();
	while (!".".equals(s1)) {
		String x;
		
		s2 = r.readLine();
		StringTokenizer t1 = new StringTokenizer(s1);
		StringTokenizer t2 = new StringTokenizer(s2);
		while (!".".equals(x=t1.nextToken())) {
			l1.add(x);
			//vypis(x);
			//allWords.add(t1.nextToken());
		}
		while (!".".equals(x=t2.nextToken())) {
			l2.add(x);
			//vypis(x);
			//allWords.add(t2.nextToken());
		}
		
		while (!(l1.isEmpty() || l2.isEmpty())) {
			w1 = l1.get(0);
			w2 = l2.get(0);
			if (w1.equals(w2)) {
				vypis(w1);
				l1.remove(0);
				l2.remove(0);	

			} else if (l1.indexOf(w2) == -1) {
				vypis(w2);
				l2.remove(0);
			} else {
				vypis(w1);
				l1.remove(0);
			}
		}
		if (!l1.isEmpty()) {
			for (String w: l1) vypis(w);
			l1.clear();
		}
		if (!l2.isEmpty()) {
			for (String w: l2) vypis(w);
			l2.clear();
		}
		System.out.println(".");
		s1 = r.readLine();
	} 
	//int n = new InputStreamReader(new BufferedReader(cin));
}

public static void main(String[] args) {
try {
	parseInput();


} catch (Exception e)	{
	e.printStackTrace();
} finally {
	try {
		r.close();
	} catch (IOException e) {
		e.printStackTrace();
	}
}
}
}