module m;int X,Y;initial while($fscanf(1<<31,"%d%d",X,Y))$write(Y/10%11?X%10:Y/100);endmodule