short x,y,u;main(w){for(;~scanf("%s%s%s",&x,&y,&u);puts(&x))for(;index(&y,w=x)?x=y:index(&u,w=y);u=w)y=u;}