while s = gets do
    a = s.split.map(&:to_i)
    b = gets.split.map(&:to_i)
    hit = 0
    blow = 0
    0.upto(3) do |i|
        0.upto(3) do |j|
            (i == j ? hit += 1 : blow += 1) if a[i] == b[j]
        end
    end
    printf("%d %d\n", hit, blow)
end