program main
  implicit none
  
  integer :: a,b
  read(*,*)a,b
  
  if ((a == 1) .and. (b == 2)) then
    write(*,*)3
  else if ((a == 1) .and. (b == 3)) then
    write(*,*)2
  else if ((a == 2) .and. (b == 1)) then
    write(*,*)3
  else if ((a == 2) .and. (b == 3)) then
    write(*,*)1
  else if ((a == 3) .and. (b == 1)) then
    write(*,*)2
  else if ((a == 3) .and. (b == 2)) then
    write(*,*)1
  end if
end program main