program y235A implicit none integer(8)::X,N,M,i integer(8),allocatable,dimension(:)::A,B integer(8)::flg=0 read(5,*)X,N,M allocate(A(N)) allocate(B(M)) read(5,*)(A(i),i=1,N) read(5,*)(B(i),i=1,M) do i=1,N if(A(i)==X)then flg=1 end if end do do i=1,M if(B(i)==X)then if(flg==0)then flg=2 else if(flg==1)then flg=3 end if end if end do if(flg==0)then print'(i0)',-1 else if(flg==1)then print'(A)',"MrMax" else if(flg==2)then print'(A)',"MaxValu" else if(flg==3)then print'(A)',"MrMaxValu" end if end program y235A