https://www.acmicpc.net/problem/20551
python
import sys input = sys.stdin.readline n, m = map(int, input().split())