import java.util.*; public class Exercise39{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); LinkedList num = new LinkedList(); for(int n = 0; n < 10; n++){ num.add(n); } int[] array = new int[4]; for (int i = 0; i < array.length; i++){ Collections.shuffle(num); array[i] = num.poll(); } h: for (int n = 0; n < 100; n++){ ArrayList q = new ArrayList(); int left = 0; int right = 0; for(int a = 0; a < 4; a++){ int x = sc.nextInt(); if (q.indexOf(x) != -1){ break h; } q.add(x); } for (int k = 0; k < 4; k++){ if (q.get(k) == array[k]){ left++; } for(int j = 0; j < 4; j++){ if (k == j){ continue; } if (q.get(k) == array[j]){ right++; } } } System.out.println(left + " " + right); System.out.flush(); if (left == 4 && right == 0){ break; } } } }