* Line 1: Three space-separated integers, respectively: K, N, and M * Lines 2..K+1: Line i+1 contains a single integer (1..N) which is the number of the pasture in which cow i is grazing. * Lines K+2..M+K+1: Each line contains two space-separated integers, respectively A and B (both 1..N and A != B), representing a one-way path from pasture A to pasture B.

第1行输入K，N，M.接下来K行，每行一个整数表示一只奶牛所在的牧场编号．接下来M行，每行两个整数，表示一条有向路的起点和终点