import sys def main(): lines = sys.stdin.readlines() n_str = lines[0].rstrip('\n') n, m = tuple(map(int, n_str.split())) assert 1 <= n <= 100000 assert 0 <= m <= 100000 assert ' '.join(map(str, (n, m))) == n_str assert len(lines) == m + 2 s = lines[1].rstrip('\n') l = [int(x.strip()) for x in s.split(' ')] l2 = [x.strip() for x in s.split(' ')] tmp = '' assert len(l) == n for i in range(n): assert -10 ** 9 <= l[i] <= 10 ** 9 tmp += l2[i] tmp += ' ' print(tmp) assert tmp == s for i in range(m): line = lines[i + 2].rstrip('\n') a, b = tuple(map(int, line.split())) assert 1 <= a <= n assert 1 <= b <= n assert ' '.join(map(str, (a, b))) == line print('OK') if __name__ == '__main__': main()