/*
TASK:sms
LANG:C++
*/
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <cstdio>
#define pb push_back
#define FOR(i,n) for(int i=0;i<n;i++)
using namespace std;

int main()
{
    int chast[101],m;
    char pod[101][20];
    char sms[101][30];
    char k;
    int i,j,n;
    cin >> n;
    FOR(i,n)
    {
            k=cin.get();
            m=0;
            while(k!='\n')
            {
                          pod[i][m]=k;
                          m++;
                          }
            k=cin.get();
            chast[i]=(int)k-'0';            
            k=cin.get();
            k=cin.get();
            m=0;
            while(k!='\n')
            {
                          pod[i][m]=k;
                          m++;
                          }              
            }
    FOR(i,n)
    {
            cout << pod[i] << endl;
            cout << chast[i] << endl;
            cout << sms[i] << endl;
            }
return 0;
}
