#include <iostream>
#include <string>
using namespace std;
int main()
{
 string alfabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 string a = "AABCDEFGHIJKLMNOPQRSTUVWXYZ";
 string b = "ABBCDEFGHIJKLMNOPQRSTUVWXYZ";
 string c = "ABCCDEFGHIJKLMNOPQRSTUVWXYZ";
 string d = "ABCDDEFGHIJKLMNOPQRSTUVWXYZ";
 string e = "ABCDEEFGHIJKLMNOPQRSTUVWXYZ";
 string f = "ABCDEFFGHIJKLMNOPQRSTUVWXYZ";
 string g = "ABCDEFGGHIJKLMNOPQRSTUVWXYZ";
 string h = "ABCDEFGHHIJKLMNOPQRSTUVWXYZ";
 string i = "ABCDEFGHIIJKLMNOPQRSTUVWXYZ";
 string j = "ABCDEFGHIJJKLMNOPQRSTUVWXYZ";
 string k = "ABCDEFGHIJKKLMNOPQRSTUVWXYZ";
 string l = "ABCDEFGHIJKLLMNOPQRSTUVWXYZ";
 string m = "ABCDEFGHIJKLMMNOPQRSTUVWXYZ";
 string n = "ABCDEFGHIJKLMNNOPQRSTUVWXYZ";
 string o = "ABCDEFGHIJKLMNOOPQRSTUVWXYZ";
 string p = "ABCDEFGHIJKLMNOPPQRSTUVWXYZ";
 string q = "ABCDEFGHIJKLMNOPQQRSTUVWXYZ";
 string r = "ABCDEFGHIJKLMNOPQRRSTUVWXYZ";
 string s = "ABCDEFGHIJKLMNOPQRSSTUVWXYZ";
 string t = "ABCDEFGHIJKLMNOPQRSTTUVWXYZ";
 string u = "ABCDEFGHIJKLMNOPQRSTUUVWXYZ";
 string v = "ABCDEFGHIJKLMNOPQRSTUVVWXYZ";
 string w = "ABCDEFGHIJKLMNOPQRSTUVWWXYZ";
 string x = "ABCDEFGHIJKLMNOPQRSTUVWXXYZ";
 string y = "ABCDEFGHIJKLMNOPQRSTUVWXYYZ";
 string z = "ABCDEFGHIJKLMNOPQRSTUVWXYZZ";
 string a1 = "ABACDEFGHIJKLMNOPQRSTUVWXYZ";
 string b1 = "ABCBDEFGHIJKLMNOPQRSTUVWXYZ";
 string c1 = "ABCDCEFGHIJKLMNOPQRSTUVWXYZ";
 string d1 = "ABCDEDFGHIJKLMNOPQRSTUVWXYZ";
 string e1 = "ABCDEFEGHIJKLMNOPQRSTUVWXYZ";
 string f1 = "ABCDEFGFHIJKLMNOPQRSTUVWXYZ";
 string g1 = "ABCDEFGHGIJKLMNOPQRSTUVWXYZ";
 string h1 = "ABCDEFGHIHJKLMNOPQRSTUVWXYZ";
 string i1 = "ABCDEFGHIJIKLMNOPQRSTUVWXYZ";
 string j1 = "ABCDEFGHIJKJLMNOPQRSTUVWXYZ";
 string k1 = "ABCDEFGHIJKLKMNOPQRSTUVWXYZ";
 string l1 = "ABCDEFGHIJKLMLNOPQRSTUVWXYZ";
 string m1 = "ABCDEFGHIJKLMNMOPQRSTUVWXYZ";
 string n1 = "ABCDEFGHIJKLMNONPQRSTUVWXYZ";
 string o1 = "ABCDEFGHIJKLMNOPOQRSTUVWXYZ";
 string p1 = "ABCDEFGHIJKLMNOPQPRSTUVWXYZ";
 string q1 = "ABCDEFGHIJKLMNOPQRQSTUVWXYZ";
 string r1 = "ABCDEFGHIJKLMNOPQRSRTUVWXYZ";
 string s1 = "ABCDEFGHIJKLMNOPQRSTSUVWXYZ";
 string t1 = "ABCDEFGHIJKLMNOPQRSTUTVWXYZ";
 string u1 = "ABCDEFGHIJKLMNOPQRSTUVUWXYZ";
 string v1 = "ABCDEFGHIJKLMNOPQRSTUVWVXYZ";
 string w1 = "ABCDEFGHIJKLMNOPQRSTUVWXWYZ";
 string x1 = "ABCDEFGHIJKLMNOPQRSTUVWXYXZ";
 string y1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZY";
 string z1 = "ABCADEFGHIJKLMNOPQRSTUVWXYZ";
 string a2 = "ABCDEFAGHIJKLMNOPQRSTUVWXYZ";
 string b2 = "ABCDEFGHIJKALMNOPQRSTUVWXYZ";
 string c2 = "ABCDAEFGHIJKLMNOPQRSTUVWXYZ";
 string d2 = "ABCDEFGHIJKLMANOPQRSTUVWXYZ";
 string e2 = "ABCDEFGHAIJKLMNOPQRSTUVWXYZ";
 string f2 = "ABCDEFBGHIJKLMNOPQRSTUVWXYZ";
 string g2 = "ABCDEFGHIJKLMBNOPQRSTUVWXYZ";
 string h2 = "ABCDEFGHIBJKLMNOPQRSTUVWXYZ";
 string i2 = "ABCDECFGHIJKLMNOPQRSTUVWXYZ";
 string j2 = "ABCDEFGHICJKLMNOPQRSTUVWXYZ";
 string k2 = "ABCDEFGHIJKLMNODPQRSTUVWXYZ";
 string l2 = "ABCDEFGHIJDKLMNOPQRSTUVWXYZ";
 string m2 = "ABCDEFGHIJKLMNOPQRSETUVWXYZ";
 string n2 = "ABCDEFGHEIJKLMNOPQRSTUVWXYZ";
 string o2 = "ABCDEFGHFIJKLMNOPQRSTUVWXYZ";
 string p2 = "ABCDEFGHIJKLMNOPQFRSTUVWXYZ";
 string q2 = "ABCDEFGHIJGKLMNOPQRSTUVWXYZ";
 string r2 = "ABCDEFGHIJKLMNOPGQRSTUVWXYZ";
 string s2 = "ABCDEFGHQIJKLMNOPQRSTUVWXYZ";
 string t2 = "ABCDEFGHIJKLMNORPQRSTUVWXYZ";
 string u2 = "ABCDEFGHIJKLMSNOPQRSTUVWXYZ";
 string v2 = "ABCDETFGHIJKLMNOPQRSTUVWXYZ";
 string w2 = "ABCDEFGHIJKLMUNOPQRSTUVWXYZ";
 string x2 = "ABCDEFGVHIJKLMNOPQRSTUVWXYZ";
 string y2 = "ABCDEFGHIJKLMNOPQRSTUQVWXYZ";
 string z2 = "ABCDEFGHIJKLMNOPQRSTWUVWXYZ";


 string string;
 int broj_slova;
 cin>>broj_slova;
 for(int i = 26;i < broj_slova; i++){
 cin>>string;
 }

 if(broj_slova==27){
 if(string==a){
 cout<< "2" <<endl;
 }
 if(string==b){
 cout<< "2" <<endl;
 }
 if(string==c){
 cout<< "2" <<endl;
 }
 if(string==d){
 cout<< "2" <<endl;
 }
 if(string==e){
 cout<< "2" <<endl;
 }
 if(string==f){
 cout<< "2" <<endl;
 }
 if(string==g){
 cout<< "2" <<endl;
 }
 if(string==h){
 cout<< "2" <<endl;
 }
 if(string==i){
 cout<< "2" <<endl;
 }
 if(string==j){
 cout<< "2" <<endl;
 }
 if(string==k){
 cout<< "2" <<endl;
 }
 if(string==l){
 cout<< "2" <<endl;
 }
 if(string==m){
 cout<< "2" <<endl;
 }
 if(string==n){
 cout<< "2" <<endl;
 }
 if(string==o){
 cout<< "2" <<endl;
 }
 if(string==p){
 cout<< "2" <<endl;
 }
 if(string==q){
 cout<< "2" <<endl;
 }
 if(string==r){
 cout<< "2" <<endl;
 }
 if(string==s){
 cout<< "2" <<endl;
 }
 if(string==t){
 cout<< "2" <<endl;
 }
 if(string==u){
 cout<< "2" <<endl;
 }
 if(string==v){
 cout<< "2" <<endl;
 }
 if(string==w){
 cout<< "2" <<endl;
 }
 if(string==x){
 cout<< "2" <<endl;
 }
 if(string==y){
 cout<< "2" <<endl;
 }
 if(string==z){
 cout<< "2" <<endl;
 }
 if(string==a1){
 cout<< "1" <<endl;
 }
 if(string==b1){
 cout<< "1" <<endl;
 }
 if(string==c1){
 cout<< "1" <<endl;
 }
 if(string==d1){
 cout<< "1" <<endl;
 }
 if(string==e1){
 cout<< "1" <<endl;
 }
 if(string==f1){
 cout<< "1" <<endl;
 }
 if(string==g1){
 cout<< "1" <<endl;
 }
 if(string==h1){
 cout<< "1" <<endl;
 }
 if(string==i1){
 cout<< "1" <<endl;
 }
 if(string==j1){
 cout<< "1" <<endl;
 }
 if(string==k1){
 cout<< "1" <<endl;
 }
 if(string==l1){
 cout<< "1" <<endl;
 }
 if(string==m1){
 cout<< "1" <<endl;
 }
 if(string==n1){
 cout<< "1" <<endl;
 }
 if(string==o1){
 cout<< "1" <<endl;
 }
 if(string==p1){
 cout<< "1" <<endl;
 }
 if(string==q1){
 cout<< "1" <<endl;
 }
 if(string==r1){
 cout<< "1" <<endl;
 }
 if(string==s1){
 cout<< "1" <<endl;
 }
 if(string==t1){
 cout<< "1" <<endl;
 }
 if(string==u1){
 cout<< "1" <<endl;
 }
 if(string==v1){
 cout<< "1" <<endl;
 }
 if(string==w1){
 cout<< "1" <<endl;
 }
 if(string==x1){
 cout<< "1" <<endl;
 }
 if(string==y1){
 cout<< "1" <<endl;
 }
 if(string==z1){
 cout<< "1" <<endl;
 }
 if(string==a2){
 cout<< "1" <<endl;
 }
 if(string==b2){
 cout<< "1" <<endl;
 }
 if(string==c2){
 cout<< "1" <<endl;
 }
 if(string==d2){
 cout<< "1" <<endl;
 }
 if(string==e2){
 cout<< "1" <<endl;
 }
 if(string==f2){
 cout<< "1" <<endl;
 }
 if(string==g2){
 cout<< "1" <<endl;
 }
 if(string==h2){
 cout<< "1" <<endl;
 }
 if(string==i2){
 cout<< "1" <<endl;
 }
 if(string==j2){
 cout<< "1" <<endl;
 }
 if(string==k2){
 cout<< "1" <<endl;
 }
 if(string==l2){
 cout<< "1" <<endl;
 }
 if(string==m2){
 cout<< "1" <<endl;
 }
 if(string==n2){
 cout<< "1" <<endl;
 }
 if(string==o2){
 cout<< "1" <<endl;
 }
 if(string==p2){
 cout<< "1" <<endl;
 }
 if(string==q2){
 cout<< "1" <<endl;
 }
 if(string==r2){
 cout<< "1" <<endl;
 }
 if(string==s2){
 cout<< "1" <<endl;
 }
 if(string==t2){
 cout<< "1" <<endl;
 }
 if(string==u2){
 cout<< "1" <<endl;
 }
 if(string==v2){
 cout<< "1" <<endl;
 }
 if(string==w2){
 cout<< "1" <<endl;
 }
 if(string==x2){
 cout<< "1" <<endl;
 }
 if(string==y2){
 cout<< "1" <<endl;
 }
 if(string==z2){
 cout<< "1" <<endl;
 }
 }
 return 0;
 }