시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 256 MB 71 13 11 19.643%

문제

선영이네 반에는 남학생과 여학생이 있다. 학생의 일부는 친구이고, 일부는 친구가 아니다. 친구 관계는 항상 양방향이라서, A와 B가 친구라면, B와 A도 친구이다.

모든 여학생의 여자인 친구는 a명, 남자인 친구는 b명이다.

모든 남학생의 여자인 친구는 c명, 남자인 친구는 d명이다.

선영이네 반의 학생의 수는 몇 명인지 구하는 프로그램을 작성하시오.

입력

첫째 줄에 문제에서 설명한 a, b, c, d가 주어진다. (1 ≤ a, b, c, d ≤ 50)

출력

각 테스트 케이스 마다, 여학생의 수 m과 남학생의 수 n을 출력한다. 가능한 정답이 여러 개인 경우에는 m과 n이 작은 것을 출력한다. 다음 줄 부터 한 줄에 하나씩 누가 누구와 친구인지를 출력한다. 같은 친구 쌍을 여러번 출력하면 안된다.

여자를 1번부터 m번, 남자를 m+1번 m+n번으로 번호를 매긴다. 

예제 입력 1

1 2 1 2

예제 출력 1

2 4
1 2
1 3
1 5
2 4
2 6
3 4
3 5
4 6
5 6

힌트

W3sicHJvYmxlbV9pZCI6Ijk0NTMiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWQ1NTlcdWMwZGRcdWM3NTggXHVjMjE4IiwiZGVzY3JpcHRpb24iOiI8cD5cdWMxMjBcdWM2MDFcdWM3NzRcdWIxMjQgXHViYzE4XHVjNWQwXHViMjk0IFx1YjBhOFx1ZDU1OVx1YzBkZFx1YWNmYyBcdWM1ZWNcdWQ1NTlcdWMwZGRcdWM3NzQgXHVjNzg4XHViMmU0LiBcdWQ1NTlcdWMwZGRcdWM3NTggXHVjNzdjXHViZDgwXHViMjk0IFx1Y2U1Y1x1YWQ2Y1x1Yzc3NFx1YWNlMCwgXHVjNzdjXHViZDgwXHViMjk0IFx1Y2U1Y1x1YWQ2Y1x1YWMwMCBcdWM1NDRcdWIyYzhcdWIyZTQuIFx1Y2U1Y1x1YWQ2YyBcdWFkMDB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