#!/usr/bin/env python3 # NOTE: it is recommended to use this even if you don't understand the following code. import sys # uncomment the two following lines if you want to read/write from files # sys.stdin = open('input.txt') # sys.stdout = open('output.txt', 'w') N, M, K = map(int, input().strip().split()) A = [0 for i in range(M)] T1 = [0 for i in range(M)] B = [0 for i in range(M)] T2 = [0 for i in range(M)] for i in range(M): A[i], T1[i], B[i], T2[i] = map(int, input().strip().split()) L = int(input().strip()) U = [0 for i in range(L)] V = [0 for i in range(L)] for i in range(L): U[i], V[i] = map(int, input().strip().split()) ans = "" leaves = [0 for i in range(M)] # INSERT YOUR CODE HERE print(ans) # only if answer is YES for i in range(M): print(leaves[i], end=' ') print() sys.stdout.close()