text: println("-1"); continue outer; } } } else if(A<=n-1) { if(na[A] <=k) { ans[x-1]=na[A]; A++; } else { out.println("-1"); continue outer; } } else { if(ma[B] <=k) { ans[x-1]=ma[B]; B++; } else { out.println("-1"); continue outer; } } } for(int x=0;x<n+m;x++) { out.print(ans[x]+" "); } out.println(); } } static void sort(int[] a) { ArrayList<Integer> l=new ArrayList<>(); for (int i:a) l.add(i); Collections.sort(l); for (int i=0; i<a.length; i++) a[i]=l.get(i); } } static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); tokenizer = null; } public String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public int[] inputarInt(int n) { int ar[]=new int[n]; for(int x=0;x<n;x++) { ar[x]=nextInt(); } return ar; } public long[] inputarLong(int n) { long ar[]=new long[n]; for(int x=0;x<n;x++) { ar[x]=nextLong(); } return ar; } } }