시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 256 MB 72 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

힌트

W3sicHJvYmxlbV9pZCI6Ijk0NTMiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWQ1NTlcdWMwZGRcdWM3NTggXHVjMjE4IiwiZGVzY3JpcHRpb24iOiI8cD5cdWMxMjBcdWM2MDFcdWM3NzRcdWIxMjQgXHViYzE4XHVjNWQwXHViMjk0IFx1YjBhOFx1ZDU1OVx1YzBkZFx1YWNmYyBcdWM1ZWNcdWQ1NTlcdWMwZGRcdWM3NzQgXHVjNzg4XHViMmU0LiBcdWQ1NTlcdWMwZGRcdWM3NTggXHVjNzdjXHViZDgwXHViMjk0IFx1Y2U1Y1x1YWQ2Y1x1Yzc3NFx1YWNlMCwgXHVjNzdjXHViZDgwXHViMjk0IFx1Y2U1Y1x1YWQ2Y1x1YWMwMCBcdWM1NDRcdWIyYzhcdWIyZTQuIFx1Y2U1Y1x1YWQ2YyBcdWFkM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