def extract_arguments(fh):
    N, M = map(int, fh.readline().strip().split())
    words = [fh.readline().strip() for _ in range(N)]
    pairs = [tuple(map(int, fh.readline().strip().split())) for _ in range(M)]
    return N, M, words, pairs