#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

void init();

struct Profile
{
    float *score;
    string fname, lname, resp, scaleA, scaleB;
    
public:
    Profile()
    :score(new float[4])
    {
        fill(score, score + 4, 0.0);
        scaleA = "ESTJ";
        scaleB = "INFP";
        cin >> fname >> lname >> resp;
    }
    
    void Assess(int);
    void Eval();
    ~Profile();    
};

int main()
{
    init();
    int num, w;
    Profile* P;
    string::iterator k;
    
    for(scanf("%d", &num) ; num-- ;)
    {
        P = new Profile;
        for( w = 1, k = P->resp.begin(); k != P->resp.end(); ++k, ++w)
            if (*k == 'A')
                P->Assess(w);
        
        P->Eval();
        P->~Profile();
    }
    
    
    return 0;
}

void init()
{
    freopen("responses.txt","r",stdin);//redirects standard input
    freopen("types.txt","w+",stdout);//redirects standard output
    cout << "\t\t\tSUBJECT'S  PERCENT  'A'  RESPONSES  PERSONALITY\n"
    << "\t\t\t_______________________________________________\n\n"
    << "|\t NAME\t\t | \tE/I\t | \tS/N\t | \tT/F\t | \tJ/P\t | \tTYPE\t |\n\n";
}

void Profile::Assess(int k)
{
    if ( (k-1) % 7 == 0 )
        ++score[0];
    else if ( (k+4) % 7 == 0 || (k+5) % 7 == 0 )
        ++score[1];
    else if ( (k+2) % 7 == 0 || (k+3) % 7 == 0 )
        ++score[2];
    else if ( k % 7 == 0 || (k + 1) % 7 == 0 )
        ++score[3];
}

void Profile::Eval()
{
    for (unsigned w = 0; w < scaleA.length(); ++w)
    {
        if (w < 1)
        {
            (int)score[w] < 5 ? scaleA[w] = scaleB[w] : (int)score[w] == 5 ? scaleA[w] = '-' : 0;
            score[w] *= 10;
        }
        else
        {
            (int)score[w] < 10 ? scaleA[w] = scaleB[w] : (int)score[w] == 10 ? scaleA[w] = '-' : 0;
            score[w] *= 5;
        }
        
    }
}

Profile::~Profile()
{
    printf("|\t%s %s\t |", fname.c_str(), lname.c_str());
    
    for (unsigned w = 0; w < scaleA.length(); ++w)
        printf("\t%.1lf\t |", score[w]);
    printf("\t%s\t |\n", scaleA.c_str() );
}