text: * After day 3, phoebe is killed and monica appears.* After day 4, monica is killed and chandler appears.# Solution import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; import java.lang.*; public class A { static long mod = 1000000007; public static void main(String[] args) throws Exception { InputReader in = new InputReader(System.in); PrintWriter pw = new PrintWriter(System.out); //int t=in.readInt(); //while(t-->0) //{ String x=in.readString(); String y=in.readString(); pw.println(x+" "+y); int n=in.readInt(); for(int i=0;i<n;i++) { String a=in.readString(); String b=in.readString(); if(a.compareTo(x)==0) { pw.println(b+" "+y); x=b; } else if(a.compareTo(y)==0) { pw.println(x+" "+b); y=b; } } //long n=in.readLong(); /*int a[]=new int[n]; for(int i=0;i<n;i++) { a[i]=in.readInt(); }*/ //String a=in.readString(); //pw.println(""); //} pw.close(); } public static long gcd(long x, long y) { if (x % y == 0) return y; else return gcd(y, x % y); } public static int gcd(int x, int y) { if (x % y == 0) return y; else return gcd(y, x % y); } public static int abs(int a, int b) { return (int) Math.abs(a - b); } public static long abs(long a, long b) { return (long) Math.abs(a - b); } public static int max(int a, int b) { if (a > b) return a; else return b; } public static int min(int a, int b) { if (a > b) return b; else return a; } public static long max(long a, long b) { if (a > b) return a; else return b; } public static long min(long a, long b) { if (a > b) return b; else return a; } public static long pow(long n, long p, long m) { long result = 1; if (p == 0) return 1; if (p == 1) return n; while (p != 0) { if (p % 2 == 1) result *= n; if (result >= m) result %= m; p >>= 1; n *= n; if (n >= m) n %= m; } return result; } public static long pow(long n, long p) { long result = 1; if (p == 0) return 1; if (p == 1) return n; while (p !