import sequtils,strutils,algorithm,math,sugar,macros,strformat import sets,tables,intsets,queues,heapqueue,bitops type Pos = tuple[x,y:int] proc putchar_unlocked(c:char){. importc:"putchar_unlocked",header: "" .} proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "" .} proc scan(): int = while true: var k = getchar_unlocked() if k < '0': break result = 10 * result + k.ord - '0'.ord let h = scan() let w = scan() proc get():(Pos,Pos)= var a : Pos var aIsAlready = false for y in 0..