#include <stdio.h>

int N, T, A[10], B[10], C[10], res;

void search(int n, int solved, int a, int b, int c)
{
    if (n == N)
    {
        if (solved > res)
            res = solved;
        return;
    }
    if (A[n] >= 0 && a + A[n] <= T) search(n + 1, solved + 1, a + A[n], b, c);
    if (B[n] >= 0 && b + B[n] <= T) search(n + 1, solved + 1, a, b + B[n], c);
    if (C[n] >= 0 && c + C[n] <= T) search(n + 1, solved + 1, a, b, c + C[n]);
    search(n + 1, solved, a, b, c);
}

int main()
{
    int cases, n;
    scanf("%d", &cases);

    while(cases-- > 0)
    {
        res = 0;
        scanf("%d %d", &N, &T);
        for (n = 0; n < N; ++n) scanf("%d", &A[n]);
        for (n = 0; n < N; ++n) scanf("%d", &B[n]);
        for (n = 0; n < N; ++n) scanf("%d", &C[n]);
        search(0, 0, 0, 0, 0);
        printf("%d\n", res);
    }

    return 0;
}
