package main import."fmt" func main(){var s,t string;var i=0;for i<32{Scan(&s, &t);if s[1]==s[2]{t=s[1:]};Print(t[0]-48);i++}}