public class Solution { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ArrayList<String> s= new ArrayList<String>(); int N=Integer.parseInt(br.readLine()); int M=Integer.parseInt(br.readLine()); int x=s.size()+M; for(int i=0;i<N;i++){ s.add(br.readLine()); } for(int i=s.size();i<x;i++) { s.add(br.readLine()); } for(int i=0;i<s.size();i++) { System.out.println(s.get(i)); } //write your code here } }