시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 128 MB298562.500%

문제

2344번 거울의 출력이 입력으로 주어졌을 때, 원래의 입력을 구하는 프로그램을 작성하시오. 즉, 거울의 각 구멍에서 쏜 빛이 나가는 구멍의 번호들이 주어졌을 때, 상자의 모양을 구해 내는 문제이다. 항상 답이 존재하는 경우만 주어진다.

입력

첫째 줄에 N, M (1 ≤ N, M ≤ 100)이 주어진다. 다음 2N+2M개 줄에는 1번 구멍으로 쏜 빛이 나가는 구멍의 번호, 2번 구멍으로 쏜 빛이 나가는 구멍의 번호, …, 2N+2M번 구멍으로 쏜 빛이 나가는 구멍의 번호가 주어진다.

출력

N개의 줄에 M개의 수로 상자의 모양을 출력한다. 답이 여러 가지 존재할 경우 아무 것이나 출력하면 된다.

예제 입력 1

2 3
9
7
10
8
6
5
2
4
1
3

예제 출력 1

0 1 0
0 1 1
W3sicHJvYmxlbV9pZCI6IjIzNDciLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWFjNzBcdWM2YjgyIiwiZGVzY3JpcHRpb24iOiI8cD48YSBocmVmPVwiXC9wcm9ibGVtXC8yMzQ0XCI+MjM0NFx1YmM4OCBcdWFjNzBcdWM2Yjg8XC9hPlx1Yzc1OCBcdWNkOWNcdWI4MjVcdWM3NzQgXHVjNzg1XHViODI1XHVjNzNjXHViODVjIFx1YzhmY1x1YzViNFx1Yzg0Y1x1Yzc0NCBcdWI1NGMsIFx1YzZkMFx1Yjc5OFx1Yzc1OCBcdWM3ODVcdWI4MjVcdWM3NDQgXHVhZDZjXHVkNTU4XHViMjk0IFx1ZDUwNFx1Yjg1Y1x1YWRmOFx1YjdhOFx1Yzc0NCBcdWM3OTFcdWMxMzFcdWQ1NThcdWMyZGNcdWM2MjQuJm5ic3A7XHVjOTg5LCBcdWFjNzBcdWM2YjhcdWM3NTggXHVhYzAxIFx1YWQ2Y1x1YmE0ZFx1YzVkMFx1YzExYyBcdWMzZGMgXHViZTViXHVjNzc0IF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