gets$9 j=-1+~/^ * / o=$' j.times{|i|o[V=i+856-j*2-o[1]*22]|=$`[i]} puts$&*(V%38/8+5),o.grep(/ /)