for(S=0;Q=readline().split(/ +/);)Q[0]&&putstr(Q[S++%Q.length]+' ')