๋ฌธ์ https://www.acmicpc.net/problem/1012 ์ฝ๋from collections import dequeT = int(input())for _ in range(T): n, m, k = map(int, input().split()) # ๊ฐ๋ก, ์ธ๋ก, ๋ฐฐ์ถ๊ฐ์ field = [[0 for _ in range(n)] for _ in range(m)] visit = [[False for _ in range(n)] for _ in range(m)] answer = 0 # ๋ฐฐ์ถ ์ง๋ ๊ทธ๋ฆฌ๊ธฐ for l in range(k): x, y = map(int, input().split()) field[y][x] = 1 for i in..