Problem:
Hit and Blow Let's play Hit and Blow game. A imagines four numbers and B guesses the numbers. After B picks out four numbers, A answers:  The number of numbers which have the same place with numbers A imagined (Hit)  The number of numbers included (but different place) in the numbers A imagined (Blow)  For example, if A imagined numbers: 9 1 8 2 and B chose: 4 1 5 9  A should say 1 Hit and 1 Blow. Write a program which reads four numbers A imagined and four numbers B chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. Input The input consists of multiple datasets. Each dataset set consists of:  a 1  a 2  a 3  a 4  b 1  b 2  b 3  b 4  , where a i (0 ≤ a i ≤ 9) is i -th number A imagined and b i (0 ≤ b i ≤ 9) is i -th number B chose. The input ends with EOF. The number of datasets is less than or equal to 50. Output For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. Sample Input 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2 Output for the Sample Input 1 1
3 0

Solution (Python):
while True:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
    except:
        break
    hit = 0
    blow = 0
    for i in range(4):
        try:
            if i == a.index(b[i]):
                hit += 1
            else:
                blow += 1
        except:
            pass
    print("{} {}".format(hit, blow))

Solution (Python):
import sys
count = 0
for line in sys.stdin:
    if count % 2 == 0:
        a = list(map(int, line.split()))
    else:
        b = list(map(int, line.split()))
        hit, brow = 0, 0
        for i in range(4):
            if a[i] == b[i]:
                hit += 1
            elif a[i] in b:
                brow += 1
        print(hit, brow)
    count += 1

Solution (Python):
import sys
res=[]

for (l,text) in enumerate(sys.stdin):
    if not l%2:
        a=list(map(int,text.split()))
    else:
        h=0
        b=0
        for (i,j) in enumerate(map(int,text.split())):
            if a[i]==j:
                h=h+1
            elif j in a:
                b=b+1
        res.extend([[h,b]])
[print(i[0],i[1]) for i in res]

Solution (Python):
while True:
  try:
    alst = input().split()
    blst = input().split()

    hit = brow = 0

    for i in range(4):
      for j in range(4):
        if alst[i] == blst[j]:
          if i == j:
            hit += 1
          else:
            brow += 1

    print(hit, brow)

  except EOFError:
    break

Solution (Python):



while True:
	try:
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
	except: break
	
	hit = blow = 0
	for i in range(4):
		if a[i] == b[i]:
			hit += 1
			b[i] = -1
	for i in range(4):
		if b[i] >= 0:
			if b[i] in a: blow += 1
	print(hit, blow)

Solution (Python):
ans = []
while True:
    try:
        a = map(int,raw_input().split())
    except EOFError:
        break
    b = map(int,raw_input().split())

    n = 0
    m = 0

    for i in range(4):
        if a[i] == b[i]:
            n += 1

    for i in range(0,4):
        for j in range(0,4):
            if a[i] == b[j]:
                m += 1
    m -= n

    ans.append(str(n)+' '+str(m))

for i in ans:
    print i

Solution (Python):
while True:
  try:
    hit=0
    brow=0
    a = map(int,raw_input().split())
    a1,b1,c1,d1 = a[0],a[1],a[2],a[3]
    b = map(int,raw_input().split())
    a2,b2,c2,d2 = b[0],b[1],b[2],b[3]
    for c in range(4):
      if a[c] == b[c]: hit +=1
      for d in range(4):
        if a[c]==b[d]:
          if c == d:
            break
          brow += 1

    print hit,brow
  except EOFError:
    break

Solution (Python):
while True:
  try:
    hit=0
    brow=0
    a = map(int,raw_input().split())
    a1,b1,c1,d1 = a[0],a[1],a[2],a[3]
    b = map(int,raw_input().split())
    a2,b2,c2,d2 = b[0],b[1],b[2],b[3]
    for c in range(4):
      if a[c] == b[c]: hit +=1
      for d in range(4):
        if a[c]==b[d]:
          if c == d:
            break
          brow += 1

    print hit,brow
  except EOFError:
    break

Solution (Python):
while True:
  try:
    hit=0
    blow =0
    a,b = raw_input(),raw_input()
    for x in range(0,7,2):
      for y in range(0,7,2):
        if a[x] == b[y]:
          if x == y: hit+=1
          else: blow +=1
    print hit,blow
  except EOFError:
      break

Solution (Python):
while True:
  try:
    hit=0
    blow =0
    a,b = raw_input(),raw_input()
    for x in range(0,7,2):
      for y in range(0,7,2):
        if a[x] == b[y]:
          if x == y: hit+=1
          else: blow +=1
    print hit,blow
  except EOFError:
      break

Solution (Python):
import sys

def calc(listA, listB):
    hit = 0
    for i, j in zip(listA, listB):
        if i == j:
            hit += 1
    brow = len(set(listA) & set(listB))
    return (hit, brow-hit)

listA = list()
listB = list()

for i, line in enumerate(sys.stdin.readlines()):
    line = line.strip()
    if i % 2 == 0:
        listA = map(int, line.split())
    else:
        listB = map(int, line.split())
        print "{0:d} {1:d}".format(*calc(listA, listB))

Solution (Python):
import sys
line=sys.stdin.readlines()
for A,B in zip(line[0::2],line[1::2]):
    a=map(int,A.strip().split())
    b=map(int,B.strip().split())
    hit,blow=0,0
    for i in xrange(4):
        if a[i]==b[i]:hit+=1
        elif a[i] in b : blow+=1
    print hit,blow

Solution (Python):

while True:
    try:
        listA = map(str,raw_input().split(' '))
        listB = map(str,raw_input().split(' '))

        hit=0
        blw=0
        for tB in listB:
            if (tB in listA) and (listB.index(tB) == listA.index(tB)):
                hit += 1
            elif (tB in listA) and (listB.index(tB) != listA.index(tB)):
                blw += 1
        print hit,blw

    except EOFError:
        break

Solution (Python):
while True:
    try:
        a = raw_input().split()
        b = raw_input().split()
        hit = reduce(lambda x,y:x+y,map(lambda x,y:x==y,a,b))
        blow = reduce(lambda x,y:x+y,map(lambda x:x in b,a)) - hit
        print hit, blow
    except EOFError:
        break

Solution (Python):
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

while True:
    a = stdin.readline().strip()
    if not a:
        break
    b = stdin.readline().strip()
    if a == b:
        print('4 0')
        continue
    hit = sum(int(a[i] == b[i]) for i in xrange(0, 7, 2))
    blow = sum(int(b[i] in a) for i in xrange(0, 7, 2)) - hit
    print(hit, blow)

Solution (Python):
while True:
    try:
        a=map(int,raw_input().split())
        b=map(int,raw_input().split())
        c1=0
        c2=0
        for i,e in enumerate(b):
            if e in a:
                if e==a[i]: c1+=1
                else: c2+=1
        print c1, c2
    except:
        break

Solution (Python):
while True:
    try:
        a = map(int, raw_input().split())
        b = map(int, raw_input().split())
        hit,blow = 0,0
        for i in range(4):
            if a[i] == b[i]:
                hit += 1
            else:
                for j in range(4):
                    if a[i] == b[j]:
                        blow += 1
        print hit, blow
    except EOFError:
        break

Solution (Python):
import sys

while True:
    try:
        a = map(int, raw_input().strip().split())
        b = map(int, raw_input().strip().split())

        hit = 0
        blow = 0

        for i in xrange(len(b)):
            if b[i] in a:
                blow += 1
            if b[i] == a[i]:
                hit += 1

        blow -= hit

        print "%d %d" % (hit, blow)

    except EOFError:
        break

Solution (Python):
while 1:
	try:
		a = map(int,raw_input().split())
		b = map(int,raw_input().split())
		c,d = 0,0
		for i in enumerate(b):
			if i[1] in a:
				if a[i[0]] == i[1]:
					c += 1
				else:
					d += 1
		print c,d
	except:
		exit()

Solution (Python):
while True:
    try:
        a = map(int, raw_input().split())
        b = map(int, raw_input().split())
        hit = 0; brow = 0
        for i in range(len(b)) :
            brow += a.count(b[i])
            if a[i] == b[i] :
                hit += 1
                brow -= 1
        print hit, brow

    except:
        break

Solution (Python):
import sys
f=0
for s in sys.stdin:
    f=1-f
    b=map(int,s.split())
    if f:
        a=b
        continue
    c1=0
    c2=0
    for i,e in enumerate(b):
        if e==a[i]: c1+=1
        elif e in a: c2+=1
    print c1, c2

Solution (Python):
import sys
f=1
for s in sys.stdin:
    b=map(int,s.split())
    if f:
        a=b
        f=0
        continue
    c1=0
    c2=0
    for i,e in enumerate(b):
        if e==a[i]: c1+=1
        elif e in a: c2+=1
    print c1, c2
    f=1

Solution (Python):
while True:
	try:
		a = map(int, raw_input().split())
		b = map(int, raw_input().split())
		hit = 0
		blow = 0
		for na, nb in zip(a, b):
			if na == nb: hit += 1
			if nb in a: blow += 1
		blow = blow - hit
		print "{} {}".format(hit, blow)
	except EOFError:
		break

Solution (Python):
while 1:
    try:
        A = map(int, raw_input().split())
        B = map(int, raw_input().split())
        hit = sum(1 for i in range(4) if A[i] == B[i])
        blow = len(set(A) & set(B)) - hit
        print hit, blow
    except:
        break

Solution (Python):



import time
import sys
import io
import re
import math
start = time.clock()
while 1:
    try:
        a=map(int, raw_input().split())
        b=map(int, raw_input().split())
        j=k=0
        for i in range(4):
            if b[i]==a[i]:
                j+=1
            elif b[i] in a:
                k+=1
        print j,k
    except:
        break

Solution (Python):
try:
    while True:
        a = map(int, raw_input().split())
        b = map(int, raw_input().split())
        p = q = 0
        for i in range(len(b)):
            if a[i] == b[i]:
                p += 1
            elif a.count(b[i]) != 0:
                q += 1
        print p, q
except:
    pass

Solution (Python):
import sys

lists=[]
for str in sys.stdin:
	lists+=[tuple(str.rstrip().split(' '))]

for i in range(0,len(lists),2):
	hit=0
	blow=0
	for j in range(4):
		if lists[i][j]==lists[i+1][j]:
			hit+=1
	for c in lists[i]:
		if c in lists[i+1]:
			blow+=1
	print '%d %d' % (hit,blow-hit)

Solution (Python):
import sys

lists = []
for str in sys.stdin:
  lists+=[tuple(str.rstrip().split(' '))]

for i in range(0, len(lists), 2):
  hit = brow = 0
  for j in range(4):
    if lists[i][j] == lists[i+1][j]:
      hit += 1
  for c in lists[i]:
    if c in lists[i+1]:
      brow += 1
  print "%d %d"%(hit, brow-hit)

Solution (Python):
import sys

state = True
for s in sys.stdin:
    if state:
        state = not state
        a = list(map(int, s.split()))
    else:
        state = not state
        b = list(map(int, s.split()))
        hit = sum(a[i] == b[i] for i in range(4))
        blow = sum(b[i] in a for i in range(4)) - hit
        print(hit, blow)

Solution (Python):
while True:
    try:
        data1 = list(map(int, input().split()))
        
        data2 = list(map(int,input().split()))
        
    except:
        break
    
    h = 0
    b = 0
    for i in range(4):
        try:
            if i == data1.index(data2[i]):
                h = h + 1
            else:
                b = b + 1
        except:
            pass
    print('{} {}'. format(h, b))

Solution (Python):
while True:
    try:
        h=0
        b=0
        a1,a2,a3,a4=map(int,input().split())
        b1,b2,b3,b4=map(int,input().split())
        if a1==b1:
            h+=1
        if a2==b2:
            h+=1
        if a3==b3:
            h+=1
        if a4==b4:
            h+=1
        if a1==b2 or a1==b3 or a1==b4:
            b+=1
        if a2==b1 or a2==b3 or a2==b4:
            b+=1
        if a3==b1 or a3==b2 or a3==b4:
            b+=1
        if a4==b1 or a4==b2 or a4==b3:
            b+=1
        print(h,b)
    except:
        break

Solution (Python):
ans = 0
while True:
    try:
        a = list(int(x) for x in input().split())
        b = list(int(x) for x in input().split())
    except EOFError:
        break
    hit = 0
    brow =0
    for i in range(4):
        if a[i] == b[i]:
            hit += 1
        else:
            for j in range(4):
                if(i != j and a[i] == b[j]):
                    brow += 1
                    
    print(str(hit)+' '+str(brow))

Solution (Python):
while True:
    try:
        a = list(map(int,input().split()))
        b = list(map(int,input().split()))
    except:
        break
    hit = 0
    blow = 0
    for i in range(4):
        if a[i] == b[i]:
            hit += 1
    for i in range(4):
        if a[i] != b[i]:
            if b[i] in a:
                blow += 1
    print(hit,blow)

Solution (Python):
while True:
    try:
        a=0
        b=0
        e1 =list(map(int,input().split()))
        e2 =list(map(int,input().split()))
        for i in range(4):
            if e1[i]==e2[i]:
                a+=1
            for j in range(4):
                if e1[i]==e2[j]:
                   b+=1
        b = b-a
        print(a,b)
    except:
        break

Solution (Python):
while True:
    try:
        A = list(map(int, input().split()));
    except EOFError:
        break;
    B = list(map(int, input().split()));

    h = 0;
    b = 0;
    for i in range(0,4):
        if A[i] == B[i]:
            h += 1;
        else:
            for j in range(0,4):
                if A[j] == B[i]:
                    b += 1;
    print(h,b);

Solution (Python):



while True:
    try:
        a=list(map(int,input().split()))
        b=list(map(int,input().split()))
    except:
        break
    
    hit=blow=0
    for i in range(4):
        if a[i]==b[i]:
            hit+=1
    for i in range(4):
        if a[i]!=b[i]:
            if b[i] in a:
                blow+=1
    
    print(hit,blow)

Solution (Python):
while 1:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
    
        hit = 0
        blow = 0

        for i in range(4):
            if a[i] == b[i]:
                hit += 1
            for j in range(4):
                if a[i] == b[j]:
                    blow += 1
        blow -= hit
        print(hit, blow)
        
    except EOFError:
        break

Solution (Python):
while True:
    try:
        a=input().split()
        b=input().split()
        hit=0
        blow=0

        for i in range(4):
            for j in range(4):
                if(a[i]==b[i]):
                    hit+=1
                    break
                if(a[i]==b[j]):
                    blow+=1
                    break

        print(hit, blow)
        
    except EOFError:
        break

Solution (Python):
while True:
    try:
        a=list(map(str,input().split()))
        b=list(map(str,input().split()))
    except EOFError:
        break
    c,d=0,0
    for i in range(4):
        if a[i]==b[i]:
            c+=1
        elif a[i] in b:
            d+=1
    print(c,d)

Solution (Python):
while 1:
    try:
        a = list(map(int,input().split()))
        b = list(map(int,input().split()))
        hit = 0
        blow = 0
        for i in range(4):
            if a[i] == b[i]:
                hit += 1
            elif b[i] in a:
                blow += 1
        print(hit,blow) 
    except:
        break

Solution (Python):
while True:
    try:
        a1,a2,a3,a4=map(int,input().split())
        b1,b2,b3,b4=map(int,input().split())

        A=[a1,a2,a3,a4]
        B=[b1,b2,b3,b4]

        b=0
        h=0
        for i in A:
            if i in B:
                b+=1
            else:
                continue
        for i in range(4):
            if A[i]==B[i]:
                h+=1
            else:
                continue
        print(h,b-h)
    except EOFError:
        break

Solution (Python):
def x(m,n):
    H = 0
    B = 0
    for i in range(4):
        if m[i] == n[i]:
            H += 1
        else:
            if m[i] in n:
                B += 1
    return(H, B)

while True:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
        print(*x(a, b))
    except:
        break

Solution (Python):
while True:
    try:
        H=0; B=0;
        a=list(map(int,input().split()))
        b=list(map(int,input().split()))
    except:
        break
    if a[0]==b[0]:
        H+=1
    if a[1]==b[1]:
        H+=1
    if a[2]==b[2]:
        H+=1
    if a[3]==b[3]:
        H+=1
    if a[0]==b[1] or a[0]==b[2] or a[0]==b[3]:
        B+=1
    if a[1]==b[0] or a[1]==b[2] or a[1]==b[3]:
        B+=1
    if a[2]==b[0] or a[2]==b[1] or a[2]==b[3]:
        B+=1
    if a[3]==b[0] or a[3]==b[1] or a[3]==b[2]:
        B+=1
    print(H, B)

Solution (Python):
while True:
    try:
        A=list(map(str,input().split()))
        B=list(map(str,input().split()))
        h=0
        b=0
        for i in range(4):
            if A[i] in B:
                b+=1
            if A[i]==B[i]:
                h+=1
        print(h,b-h)
    except EOFError:
        break

Solution (Python):
try:
    while True:
        a1,a2,a3,a4=map(int,input().split())
        b1,b2,b3,b4=map(int,input().split()) 
        h=0
        b=0
        if a1==b1:
            h+=1
        if a2==b2:
            h+=1
        if a3==b3:
            h+=1
        if a4==b4:
            h+=1
        A = [a1,a2,a3,a4]
        B = [b1,b2,b3,b4]
    
        for i in A:
            for j in B:
                if i == j:
                    b +=1
        b = b - h
        
        print(h,b)
except EOFError:
    pass

Solution (Python):
while True:
   try:
      A = input().split()
      B = input().split()
      h = 0
      b = 0
      for i in range(4):
         for j in range(4):
            if A[i] == B[j]:
               if i == j:
                  h += 1
               else:
                  b += 1
            else:
               pass
      print(h, b)
   except EOFError:
      break

Solution (Python):
while True:
    try:
        A = map(int,input().split())
        ls_A = list(A)
        B = map(int,input().split())
        ls_B = list(B)
        h = 0
        b = 0
        for i in range(len(ls_A)):
            if ls_A[i] == ls_B[i]:
                h += 1
        if ls_A[0] == ls_B[1]:
            b += 1
        if ls_A[0] == ls_B[2]:
            b += 1
        if ls_A[0] == ls_B[3]:
            b += 1
        if ls_A[1] == ls_B[0]:
            b += 1
        if ls_A[1] == ls_B[2]:
            b += 1
        if ls_A[1] == ls_B[3]:
            b += 1
        if ls_A[2] == ls_B[0]:
            b += 1
        if ls_A[2] == ls_B[1]:
            b += 1
        if ls_A[2] == ls_B[3]:
            b += 1
        if ls_A[3] == ls_B[0]:
            b += 1
        if ls_A[3] == ls_B[1]:
            b += 1
        if ls_A[3] == ls_B[2]:
            b += 1   
        print(h,b)
    except EOFError:
        break

Solution (Python):
while True:
    try:
        a=list(input())
        b=list(input())
        a=[i for i in a if i!=' ']
        b=[j for j in b if j!=' ']
        hit=blow=0
        for i in range(4):
            for j in range(4):
                if a[i]==b[j]:
                    if i==j:
                        hit+=1
                    else:
                        blow+=1
        print(hit,blow)
    except EOFError:
        break

Solution (Python):
while True:
    try:
        a1,a2,a3,a4=map(int,input().split())
        b1,b2,b3,b4=map(int,input().split())

        A=[a1,a2,a3,a4]
        B=[b1,b2,b3,b4]

        b=0
        h=0
        for i in A:
            if i in B:
                b+=1
            else:
                continue
        for i in range(4):
            if A[i]==B[i]:
                h+=1
            else:
                continue
        print(h,b-h)
    except EOFError:
        break

Solution (Python):
while True:
    try:
        A = list(map(int, input().split()))
        B = list(map(int, input().split()))
        a = b = 0
        for i in range(4):
            if A[i] == B[i]:
                a+=1
            elif B[i] in A:
                b+=1
        print(a, b)
    except:
        break

Solution (Python):
while True:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
        hit, blow = 0, 0
        for i in range(4):
            if a[i] == b[i]:
                hit += 1
            elif (b[i] in a) == 1:
                blow += 1
        print(hit, blow)
    except:
        break

Solution (Python):
try:
    while True:
        L=0
        M=0
        
        A=list(map(int,input().split()))
        B=list(map(int,input().split()))
        
        for i in range(4):
            if A[i]==B[i]:
                L+=1
            
            C=A.count(B[i])
            if C>=1:
                M+=1
                
        print(L,M-L)
        
except EOFError:
    pass

Solution (Python):
while True:
    try:
        a = list(map(int,input().split()))
        b = list (map(int,input().split()))
    except:
        break
    hit = blow = 0
    for i in range(4):
        if a[i] == b[i]:
            hit += 1
        for j in range(4):
            if i != j and a[i] == b[j]:
                blow +=1
    print(hit,blow)

Solution (Python):

while True:
    c = 0
    d = 0
    l = []
    m = []
    try:
        a1,a2,a3,a4 = map(int,input().split())
        b1,b2,b3,b4 = map(int,input().split())
    except:
        break
    l.extend([a1,a2,a3,a4])
    m.extend([b1,b2,b3,b4])

    for i in range(4):
        for k in range(4):
            if l[i] == m[k]:
                if i == k:
                    c += 1
                else:
                    d += 1
    print(c,d)

Solution (Python):
while True:
    try:
        a=input().split()
        b=input().split()
    except:
        break
    hit=0
    blow=0
    for i in range(4):
        x=a.count(b[i])
        blow+=x
        if a[i]==b[i]:
            hit+=1
            blow-=1
    print(hit,blow)

Solution (Python):



while True:
   try:
      A = list(input())
      B = list(input())
      
      for i in range(A.count(' ')):
         A.remove(' ')
      for i in range(B.count(' ')):
         B.remove(' ')
      
      
      h = 0 
      b = 0 
      for i in range(4):
         for j in range(4):
            if A[i] == B[j]:
               if i == j:
                  h += 1
               else:
                  b += 1
      print(h, b)

   except EOFError:
      break

Solution (Python):
while True:
    try:
        Alst = list(map(int, input().split()))
        Blst = list(map(int, input().split()))
        H = 0
        B = 0

        for a, anum in enumerate(Alst):
            for b, bnum in enumerate(Blst):
                if anum == bnum:
                    if a == b:
                        H = H + 1
                    else:
                        B = B + 1

        print(str(H) + ' ' + str(B))


    except EOFError:
        break

Solution (Python):
while True:
    try:
        A=list(map(int,input().split()))
        B=list(map(int,input().split()))
        C=[]
        for i in range(4):
            if B[i]==A[i]:
                C.append("h")
            elif B[i] in A:
                C.append("b")
            else:
                pass
        H=C.count("h")
        B=C.count("b")
        print(H,B)
    except:
        break

Solution (Python):
while True:
	try:
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
	except:
	    break
	
	h = 0
	bl = 0
	
	for i in range(4):
            if a[i] == b[i]:
                h += 1
                b[i] = 51
	for i in range(4):
            if a[i] in b:
                bl += 1
	 
	print(h,bl)

Solution (Python):
while True:
    try:
        A=list(map(int,input().split()))
        B=list(map(int,input().split()))
    except:
        break

    h=0
    for i in range(4):
        if A[i]==B[i]:
            h+=1
    b=0
    for i in A:
        if i in B:
            b+=1
    b-=h
    print(h,b)

Solution (Python):
while 1:
    try:
        a = list(map(int,input().split()))
        b = list(map(int,input().split()))
        hit = 0
        blow = 0
        for i in range(4):
            if a[i] == b[i]:
                hit += 1
            elif b[i] in a:
                blow += 1
        print(hit,blow) 
    except:
        break

Solution (Python):
while True:
    try:
        a = [a for a in input().split()]
        b = [b for b in input().split()]
    except:
        break
    
    hit = 0
    blow = 0
    
    for i in range(4):
        if b[i] in a :
            blow += 1
            if b[i]==a[i]:
                hit += 1
    
    blow = blow-hit
    print(hit,blow)

Solution (Python):
while True :
    try :
        A = list(input().split())
        B = list(input().split())
        
        hit = 0
        blow = 0
        
        for i in range(4) :
            if A[i] == B[i] :
                hit += 1
                
            elif B[i] in A :
                blow += 1
                
        print(hit, blow)
    
    except :
        break

Solution (Python):
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
    *A, = map(int, readline().split())
    *B, = map(int, readline().split())
    v1 = v2 = 0
    for i in range(4):
        if A[i] == B[i]:
            v1 += 1
        for j in range(4):
            if i != j and A[i] == B[j]:
                v2 += 1
    write("%d %d\n" % (v1, v2))
try:
    while 1:
        solve()
except:
    ...

Solution (Python):
while True :
    try :
        a1, a2, a3, a4 = map(int, input().split())
        b1, b2, b3, b4 = map(int, input().split())
    except EOFError :
        break
    
    hit = 0
    brow = 0
    if a1 == b1 :
        hit += 1
    if a2 == b2 :
        hit += 1
    if a3 == b3 :
        hit += 1
    if a4 == b4 :
        hit += 1
    if a1 == b2 or a1 == b3 or a1 == b4 :
        brow += 1
    if a2 == b1 or a2 == b3 or a2 == b4 :
        brow += 1
    if a3 == b1 or a3 == b2 or a3 == b4 :
        brow += 1
    if a4 == b1 or a4 == b2 or a4 == b3 :
        brow += 1
        
    print(hit, brow)

Solution (Python):
while True:
	try:
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
	except: break
	
	hit = blow = 0
	for i in range(4):
		if a[i] == b[i]:
			hit += 1
			b[i] = -1
	for i in range(4):
		if b[i] >= 0:
			if b[i] in a:
			    blow += 1
	print(hit, blow)

Solution (Python):
try:
    while True:
        
        a_line = list(map(int,input().split()))
        b_line = list(map(int,input().split()))
        num1 = 0
        num2 = 0
        
        for num in range(0,4):
            if a_line[num] == b_line[num]:
                num1 += 1
                continue
            else:pass
            if a_line[num] in b_line:num2 += 1
            else:pass
        print(str(num1) + " " + str(num2))

except EOFError:
    pass

Solution (Python):
while True:
    try:
        alist = input().split()
        blist = input().split()
        hit = brow = 0
        
        for i in range(4):
            for j in range(4):
                if alist[i] == blist[j]:
                    if i == j:
                        hit += 1
                    else:
                        brow += 1
        print(hit,brow)
    except EOFError:
        break

Solution (Python):
while True:
    try:
        a = list(int(x) for x in input().split())
        b = list(int(x) for x in input().split())
    except EOFError:
        break
    hit = 0
    brow = 0
    for i in range(4):
        if a[i] == b[i]:
            hit += 1
        else:
            for j in range(4):
                if(i != j and a[i] == b[j]):
                    brow += 1
                    
    print(str(hit) + " " + str(brow))

Solution (Python):
c = 0
while True:
    try:
        if c % 2 == 0:
            A = [int(x) for x in input().split()]
        else:
            B = [int(x) for x in input().split()]
            hit = blow = 0
            for i in range(len(B)):
                if A[i] == B[i]:
                    hit += 1
                else:
                    if B[i] in A:
                        blow += 1
            print(hit,blow)
                
        c += 1    
    except EOFError:
        break

Solution (Python):
"""while True:
	try:
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
	except: break
	
	hit = blow = 0
	for i in range(4):
		if a[i] == b[i]:
			hit += 1
			b[i] = -1
	for i in range(4):
		if b[i] >= 0:
			if b[i] in a: blow += 1
	print(hit, blow)
"""
while True:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
    except:
        break
    hit = blow = 0
    for i in range(4):
        if (a[i] == b[i]):
            hit += 1
            b[i] = -1
    for i in range(4):
        if b[i] >= 0:
            if b[i] in a:
                 blow += 1
    print(hit, blow)

Solution (Python):
while True:
    try:
        a=list(map(int, input().split()))
        
        b=list(map(int, input().split()))
        
        hit=0
        blow=0
        for i in range(len(b)):
            if b[i] in a:
                if b[i]==a[i]:
                    hit+=1
                else:
                    blow+=1
        print(hit,blow,)
    except:
        break

Solution (Python):
while 1:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
        hit, blow = 0, 0
        for i in range(4):
            if a[i] == b[i]:
                hit += 1
            elif (b[i] in a) == 1:
                blow += 1
        print(hit, blow)
    except:
        break

Solution (Python):
while True:
    try:
        a=list(map(int,input().split()))
    except:break
    b=list(map(int,input().split()))
    h=0
    for i,j in zip(a,b):h+=i==j
    print(h,len(set(a)&set(b))-h)

Solution (Python):
while True :
    try :
        a = [int(_) for _ in input().split()]
        b = [int(_) for _ in input().split()]
        hit, blow = 0, 0
        for _ in range(4) :
            if a[_] == b[_] : hit += 1
            elif b[_] in a : blow += 1
        print(hit, blow)
    except : break

Solution (Python):
while True:
    try:
        a= list(map(int,input().split()))
        b= list(map(int, input().split()))
        hit = sum([1 for i in range(4) if a[i] == b[i]])
        blow = sum([1 for i in range(4) for j in range(4) if i != j and a[i] == b[j]])
        print(str(hit) + " " + str(blow))
    except:
        break

Solution (Python):
if __name__ == '__main__':

	while True:
		try:
			A = input().split()
			B = input().split()

			hit = 0
			blow = 0
			for i in range(4):
				if A[i] == B[i]:
					hit += 1
				else:
					if B[i] in A:
						blow += 1

			print(hit,blow)

		except EOFError:
			break

Solution (Python):
while 1:
   try:
       h = 0
       b = 0
       que=input().split(" ")
       ans=input().split(" ")
       for i in range(4):
             for j in range(4):
                    if que[i] == ans[j] and i != j:
                         b = b + 1
                    if que[i] == ans[j] and i == j:
                         h = h + 1
       print(str(h) + " " + str(b))
   except:break

Solution (Python):
while 1:
    try:
        A = input().split()
        B = input().split()
        hit = len([i for i in range(len(A)) if B[i] == A[i]])
        blow = len([i for i in range(len(A)) if B[i] in A]) - hit
        print(str(hit) + " " + str(blow))
    except:
        break