T={} function f(x,y)return((T[y]or{})[x]or 0)>32 and 1 or 0;end for L in io.lines()do T[#T+1]={L:byte(1,#L)};end x=1;y=1 while T[y][x]do io.write(string.char(T[y][x])) T[y][x]=nil x,y=x+f(x+1,y)-f(x-1,y),y+f(x,y+1)-f(x,y-1) end