#include <bits/stdc++.h>
using namespace std;

struct ThiSinh {
    string ten, ngaysinh, gioitinh;
};

int main() {
    freopen("BAI3.INP","r",stdin);
    freopen("BAI3.OUT","w",stdout);
    int n;
    cin >> n;
    cin.ignore();
    vector<ThiSinh>ds;
    for (int i=0;i<n;i++) {
        string s;
        getline(cin,s);
        stringstream ss(s);
        string ten,ngaysinh,gioitinh,monthi;
        getline(ss,ten,'#');
        getline(ss,ngaysinh,'#');
        getline(ss,gioitinh,'#');
        getline(ss,monthi);
        if (monthi=="Tin") {
            ds.push_back({ten,ngaysinh,gioitinh});
        }
    }
    if (ds.empty()) {
        cout << "#";
    } else {
        cout << "Mon thi chuyen: Tin hoc" << endl;
        cout << "Thong tin thi sinh:" << endl;
        for (auto x:ds) {
            cout << x.ten << "@" << x.gioitinh << "@" << x.ngaysinh << endl;
        }
        cout << "Danh sach gom co: " << ds.size() << " thi sinh";
    }
}
