while gets
  a = $_.split.map(&:to_i)
  b = gets.split.map(&:to_i)
  hit = blow = 0

  for i in 0...4
    if a[i] == b[i]
      hit += 1
      next
    end

    for j in 0...4
      if a[i] == b[j]
        blow += 1
        break
      end
    end
  end

  printf("%d %d\n", hit, blow)
end