# include <stdio.h> int main() { int A,B,C,T,i,j; int a[4]={0,0,0,0}; C=-1; scanf("%d",&T); for(i=1;i<=T;i++) { scanf("%d %d",&A,&B); if ((A ==0 && B == 0) || A + B == 1e6) C = 0; else { for(j=1;j<=3;...