Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all trains have the same speed. Let's take a look at the picture below.

<image>

The train system can be represented as coordinates on a 2D plane. The i-th train starting at the bottom end is initially at (i,0) and will be at (i,T) after T minutes, and the i-th train starting at the left end is initially at (0,i) and will be at (T,i) after T minutes. All trains arrive at their destinations after 101 minutes.

However, Gildong found that some trains scheduled to depart at a specific time, simultaneously, are very dangerous. At this time, n trains are scheduled to depart from the bottom end and m trains are scheduled to depart from the left end. If two trains are both at (x,y) at the same time for some x and y, they will crash into each other. Therefore, he is asking you to find the minimum number of trains that should be cancelled to prevent all such crashes.

Input

Each test contains one or more test cases. The first line contains the number of test cases t (1 ≤ t ≤ 100).

Each test case contains three lines. The first line of each test case consists of two integers n and m (1 ≤ n, m ≤ 100) — the number of trains scheduled to depart from the bottom end, and the number of trains scheduled to depart from the left end, respectively.

The second line of each test case contains n integers. Each integer is a train number that is scheduled to start from the bottom end. The numbers are given in strictly increasing order, and are between 1 and 100, inclusive.

The third line of each test case contains m integers. Each integer is a train number that is scheduled to start from the left end. The numbers are given in strictly increasing order, and are between 1 and 100, inclusive.

Output

For each test case, print a single integer: the minimum number of trains that should be canceled in order to prevent all crashes.

Example

Input


3
1 2
1
3 4
3 2
1 3 4
2 4
9 14
2 7 16 28 33 57 59 86 99
3 9 14 19 25 26 28 35 41 59 85 87 99 100


Output


0
1
3

Note

In the first case, we can show that there will be no crashes if the current schedule is followed. Therefore, the answer is zero.

In the second case, at T=4, there will be a crash, as can be seen in the picture below. We can prove that after canceling one of these trains, the remaining trains will not crash. Therefore, the answer is one.

<image>

import java.awt.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
import java.util.List;

/**
 * Codeforces
 * 
 * 
 */
public class Codeforcess {

    public static boolean has1inbetween(String s, int i, int j) {
        boolean ans = true;
        char ch[] = s.toCharArray();

        for (int b = i + 1; b < j && b < s.length() && i < ch.length && j < ch.length; b++) {
            if (ch[i] == '1') {
                ans = false;
            }
        }
        return ans;
    }

    public static int segregate(int arr[], int size) {
        int j = 0, i;
        for (i = 0; i < size; i++) {
            if (arr[i] <= 0) {
                int temp;
                temp = arr[i];
                arr[i] = arr[j];
                arr[j] = temp;
                // increment count of non-positive
                // integers
                j++;
            }
        }

        return j;
    }

    public static long lowComMultiple(long a, long b) {
        long min = a * b;
        long start = Math.min(a, b);
        long ans = -1;
        for (int i = (int) start; i <= min; i++) {
            if (i % a == 0 && i % b == 0) {
                ans = i;
                break;
            }
        }
        return ans;
    }

    public static int solution(int[] A) {
        int n = A.length;

        // To mark the occurrence of elements
        boolean[] present = new boolean[n + 1];

        // Mark the occurrences
        for (int i = 0; i < n; i++) {

            if (A[i] > 0 && A[i] <= n)
                present[A[i]] = true;
        }

        // Find the first element which didn't
        // appear in the original array
        for (int i = 1; i <= n; i++)
            if (!present[i])
                return i;

        return n + 1;
    }

    public static ArrayList<Long> digit(long num) {
        long dig = 0;
        // long length = 0;
        ArrayList<Long> digi = new ArrayList<>();
        while (num > 0) {
            dig = num % 10;
            digi.add(dig);
            num = num / 10;

        }
        // return dig; //System.out.printf("%d", +revnum);

        return digi;
    }

    static int[] shuffle(int a[], int n) {
        for (int i = 0; i < n; i++) {

            // getting the random index
            int t = (int) Math.random() * a.length;

            // and swapping values a random index
            // with the current index
            int x = a[t];
            a[t] = a[i];
            a[i] = x;
        }
        return a;
    }

    public static long addDigits(long num) {
        long digit = 0;
        // long sum = 0;
        long dig = -1;

        while (num != 0) {
            digit = num % 10;
            dig = digit;
            num = num / 10;
            break;
        }
        return dig;
    }

    public static int addDigit(long num) {
        long digit = 0;
        // long sum = 0;
        int count = 0;

        while (num != 0) {
            digit = num % 10;
            count++;
            num = num / 10;

        }
        return count;
    }

    public static class Pair<A, B> {
        private A first;
        private B second;

        public Pair(A first, B second) {
            this.first = first;
            this.second = second;
        }

        public A getFirst() {
            return first;
        }

        public B getSecond() {
            return second;
        }

        public void setFirst(A first) {
            this.first = first;
        }

        public void setSecond(B second) {
            this.second = second;
        }
    }

    static void findPair(int values[], int n, Pair<Integer, Integer> ans) {
        // Pair<Integer, Integer> ans = new Pair<Integer,Integer>(0, 0);
        int size = values.length;
        int i = 0, j = 1;
        int minLen = Integer.MAX_VALUE;
        int in = -1;
        int jn = -1;
        while (i < size && j < size) {

            if (i != j && values[j] - values[i] == n) {

                if (j - i < minLen) {
                    in = i;
                    jn = j;
                }
                break;
                // System.out.print("Pair Found: " + "( " + values[i] + ", " + values[j] + "
                // )");
                // return "1";
            } else if (values[j] - values[i] < n)
                j++;
            else
                i++;
        }

        if (in == -1 && jn == -1) {
            ans.setFirst(-1);
            ans.setSecond(-1);
        } else {
            ans.setFirst(in + 1);
            ans.setSecond(jn + 1);
        }

        // return ans;
    }

    public static String findMinDays(int[] values, int[] profit) {

        StringBuilder str = new StringBuilder();
        ArrayList<Pair<Integer, Integer>> ans = new ArrayList<>();
        Pair<Integer, Integer> p = new Pair<Integer, Integer>(0, 0);
        for (int i = 0; i < profit.length; i++) {
            findPair(values, profit[i], p);
            ans.add(p);
        }

        for (int i = 0; i < ans.size(); i++) {
            if (ans.get(i).getFirst() != -1 || ans.get(i).getSecond() != -1) {
                str.append(ans.get(i).getFirst());
                str.append(" ");
                str.append(ans.get(i).getSecond() + ",");
            } else {
                str.append(-1 + ",");
            }
        }

        String s;
        str.setCharAt(str.length() - 1, ' ');
        s = str.toString();
        return s;

    }

    public static long fact(long n) {
        BigInteger res = new BigInteger("1");
        for (long i = 2; i <= n; i++)
            res = res.multiply(BigInteger.valueOf(i));
        return res.longValue();
    }

    public static long nCr(long n, long r) {
        long den = (fact(r) * fact(n - r));
        long num = fact(n);
        if (den <= 0 || num < 0)
            return 1;
        else
            return num / den;

    }

    public static int[] seq(int n, int x, int y) {
        int best = Integer.MAX_VALUE;
        int[] bestArr = new int[n];
        for (int start = 1; start <= 50; start++) {
            for (int diff = 1; diff <= 50; diff++) {
                boolean X = false, Y = false;
                int[] a = ap(n, start, diff);
                for (int i = 0; i < n; i++) {
                    if (a[i] == x)
                        X = true;
                    if (a[i] == y)
                        Y = true;

                }
                if (X && Y && a[n - 1] < best) {
                    best = a[n - 1];
                    bestArr = a;
                }
            }
        }
        return bestArr;
    }

    public static int[] ap(int n, int start, int diff) {
        int arr[] = new int[n];
        arr[0] = start;
        for (int i = 1; i < n; i++) {
            arr[i] = arr[i - 1] + diff;
        }
        return arr;
    }

    public static int cntSame(String s) {
        int ans = 0;
        for (int i = 1; i < s.length(); i++) {
            if (s.charAt(i - 1) == s.charAt(i)) {
                ans++;

            }
        }
        if (ans % 2 == 0)
            ans = ans / 2;

        return ans;
    }

    public void dump() {

        // int n = sc.nextInt();
        // int m = sc.nextInt();
        // int countNRow = 0;
        // int totalNeg = 0;
        // ArrayList<Integer> rowSignAcc = new ArrayList<>();
        // int arr[][] = new int[n][m];
        // for (int i = 0; i < n; i++) {
        // countNRow = 0;
        // for (int j = 0; j < m; j++) {
        // arr[i][j] = sc.nextInt();
        // if (arr[i][j] < 0) {
        // totalNeg++;
        // countNRow++;
        // }

        // }
        // rowSignAcc.add(countNRow);
        // }
        // int sum = 0, sum1 = 0;
        // for (int i = 0; i < n; i++) {
        // for (int j = 0; j < m; j++) {
        // if (arr[i][j] < 0) {
        // arr[i][j] = -1 * arr[i][j];
        // sum += arr[i][j];
        // } else {
        // sum += arr[i][j];
        // }
        // }
        // }
        // if (totalNeg % 2 == 0) {
        // System.out.println(sum);
        // } else {
        // arr[0][0] = -1 * arr[0][0];
        // for (int i = 0; i < n; i++) {
        // for (int j = 0; j < m; j++) {
        // sum1 += arr[i][j];
        // }
        // }
        // System.out.println(sum1);
        // }

        // }

    }

    public static boolean isPrime(long number) {
        if (number == 1)
            return false;
        else {
            for (long i = number - 1; i > 1; i--) {
                if (number % i == 0) {
                    return false;
                }
            }
            return true;
        }
    }

    public static boolean isRotations(String s1, String s2) {
        String temp = s1 + s1;
        // for (int i = 0; i < temp.length(); i++) {
        // for (int j = i + 1; j <= temp.length(); j++) {
        // String ans = temp.substring(i, j);
        // if (ans.equals(s2))
        // return true;

        // }
        // }
        return (s1.length() == s2.length()) && ((s1 + s1).indexOf(s2) != -1);
    }

    public static long Digits(BigInteger num) {
        BigInteger digit;

        long sum = 0;

        // StringBuilder rev = new StringBuilder();
        while (num.compareTo(BigInteger.valueOf(0)) != 0) {
            digit = num.remainder(BigInteger.valueOf(10));
            sum++;

            num = num.divide(BigInteger.valueOf(10));
        }

        return sum;
    }

    public static void main(String[] args) {

        try {
            Scanner sc = new Scanner(System.in);
            int t = sc.nextInt();

            while (t-- > 0) {
                int n = sc.nextInt();
                int m = sc.nextInt();

                ArrayList<Integer> arrN = new ArrayList<>();
                ArrayList<Integer> arrM = new ArrayList<>();

                for (int i = 0; i < n; i++) {
                    arrN.add(sc.nextInt());
                }
                for (int j = 0; j < m; j++) {
                    arrM.add(sc.nextInt());
                }
                Collections.sort(arrN);
                Collections.sort(arrM);

                Map<Integer, Integer> ans = new HashMap<>();

                for (int i = 0; i < n; i++) {
                    ans.put(arrN.get(i), 0);
                }
                for (int j = 0; j < m; j++) {
                    if (ans.containsKey(arrM.get(j))) {
                        ans.put(arrM.get(j), 2);
                    }
                }
                int c = 0;
                for (Map.Entry<Integer, Integer> entry : ans.entrySet()) {
                    if (entry.getValue() == 2) {
                        c++;
                    }
                }
                System.out.println(c);
            }

        } catch (Exception e) {
            System.out.println(e);
        }

    }
}
