a[30],i;main(j){for(;~scanf("%d",&j);*a+=11-i*2-i/2*7-i/3*18)i=(++a[j]+1)%4;puts("NO HAND*THREE CARDONE PAIRFULL HOUSETWO PAIR"+*a);}