1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#define ONLINE_JUDGE
#include <iostream>
#include <string>
#include <vector>
#include <map>
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    vector<string> allPositions{"1A", "1B", "1C", "2A", "2B", "2C", "3A", "3B", "3C", "4A", "4B", "4C", "5A", "5B", "5C" };
    vector<int> requiredProblems{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 };
    int ideas;
    cin >> ideas;
    map<string, int> positionToIdeas;
    string position;

    for (int i = 0; i < ideas; ++i)
    {
        cin >> position;
        ++positionToIdeas[position];
    }

    bool isOk = true;
    for (int i = 0; i < allPositions.size(); ++i)
    {
        const string currentPosition = allPositions[i];
        if (positionToIdeas[currentPosition] < requiredProblems[i])
        {
            isOk = false;
            break;
        }
    }

    if (isOk)
        cout << "TAK\n";
    else
        cout << "NIE\n";
#ifndef ONLINE_JUDGE
    system("pause");
#endif

    return 0;

}