import sys input = sys.stdin.readline H,W,sx,sy,N=list(map(int,input().split())) X=[list(map(int,input().split())) for i in range(N)] DP=[0]*N x,y,c=X[0] if x==sx or y==sy or (x+y)==(sx+sy) or (x-y)==(sx-sy): DP[0]=c if N>=2: DP[1]=X[1][2] for i in range(N): x0,y0,c0=X[i] if i+1