#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int n,m;
scanf("%d%d", &n, &m);
const int max=1005;
char t1[max], t2[max];
gets(t1);
gets(t2);
printf("%s\n%s", t1, t2);
return 0;
}
Or you can also see the code link on ideone