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
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#include <iostream>
#include <string>
int spr1[15];
using namespace std;
int main()
{
    int i1 = 0;
	while (i1!=15)
	{
		spr1[i1] = 0;
		i1++;
	}
	int i;
	cin >> i;
	while (i!=0)
	{
		i--;
		/*cout << i<<", ";*/
		int cos = 0;
		int sprTab = 0;
		cos++;
		string spr;/*
		getline(cin,spr);*/
		cin >> spr;/*
		cout << spr << ", ";*/
		if (spr == "1A")
		{
			sprTab = 0;
		}
		else if (spr == "2A")
		{
			sprTab = 1;
		}
		else if (spr == "3A")
		{
			sprTab = 2;
		}
		else if (spr == "4A")
		{
			sprTab = 3;
		}
		else if (spr == "5A")
		{
			sprTab = 4;
		}
		else if (spr == "1B")
		{
			sprTab = 5;
		}
		else if (spr == "2B")
		{
			sprTab = 6;
		}
		else if (spr == "3B")
		{
			sprTab = 7;
		}
		else if (spr == "4B")
		{
			sprTab = 8;
		}
		else if (spr == "5B")
		{
			sprTab = 9;
		}
		else if (spr == "1C")
		{
			sprTab = 10;
		}
		else if (spr == "2C")
		{
			sprTab = 11;
		}
		else if (spr == "3C")
		{
			sprTab = 12;
		}
		else if (spr == "4C")
		{
			sprTab = 13;
		}
		else if (spr == "5C")
		{
			sprTab = 14;
		}
		/*cout << sprTab;*/
		/*cout <<endl<< sprTab;*/
		spr1[sprTab] = spr1[sprTab]+1;
		/*cout << sprTab;*/
		sprTab = 0;
	}
	int len = 14;
	int sprawdzajaca = 0;
	while (len != -1)
	{
		if (spr1[len] > 0)
		{
			if ((len != 4) && (len != 9) && (len != 14))
			{
				sprawdzajaca++;
			}
			else if (spr1[len] > 1)
			{
				sprawdzajaca++;
			}
			/*cout<< len<<" , .";
			cout << sprawdzajaca<<", ";*/
		}
		len--;
	}
	if (sprawdzajaca == 15)
	{
		cout << "TAK";
	}
	else
	{
		cout << "NIE";
	}
}