import sys readline = sys.stdin.readline N, M = map(int, readline().split()) assert 2 <= N <= 1000 assert 1 <= M <= min(N*(N-1)//2, 2500) for _ in range(M): u, v, w = map(int, readline().split()) assert 1 <= u <= N assert 1 <= v <= N assert 1 <= w <= 10**9 print('ok')