import java.util.*; import java.io.*; public class Main{ public static void main(String[] args) throws IOException, ClassNotFoundException{ boolean[] f = new boolean[1000005]; for(int i=2; i a1 = (ArrayList) o1.readObject(); ArrayList a2 = (ArrayList) o2.readObject(); TreeSet t = new TreeSet<>(a1); t.forEach(e -> { if(f[e] && n-e > e && f[n-e]){ if(a2.contains(n-e)) System.out.println(e + " " + (n-e)); } }); } }