p=1e9;x,y;main(a,b){for(scanf("%d%d",&a,&b);;p/=10){x==y?y=b/p%10:exit(!printf("%d",x