#include <bits/stdc++.h>

using namespace std;

int main()
{
    int t,n,i,n1,p;
    cin>>t;
    for (i=0;i<t;i++){
        cin>>n;
        for (i=0;i<n;i++){
        while (cin>>n){
            n1=n%10;
            p*=n1;
            break;
        }
        }
        
    }
    return 0;
}