#!/usr/bin/python
from string import atoi
from numarray import zeros


n = 5

'''
Republic Of China Students Association
Taiwan Graduate Students Association
Taiwanese Graduate Students Association
Taiwan, Republic Of China Students Association
25N121E
'''

abbrev = ['ROCSA','TGSA','TsGSA','TROCSA','25N121E']
 
def main():

    data = file('votes/BALLOTS').readlines()
    ballots = []
    for line in data:
        if line == '\n':
            continue
        line = line.split(']')
        time = line[1].strip()
        line = line[0]
        line = line.replace('[','')
        line = line.split(',')
        ballots.append([])
        for item in line:
            ballots[-1].append(atoi(item.strip()))
        ballots[-1]=(ballots[-1],time)


    for ballot in ballots:
        time = ballot[1]
        ballot = ballot[0]
        line = ''
        for i in range(n):
            list = [j for j in range(n) if ballot[j] == i+1]
            ll = len(list)
            if ll > 0:
                if line != '':
                    line += '>'
                line +=  abbrev[list[0]]
                for k in range(1,ll):
                    line += ('=' + abbrev[list[k]])
        print line#, time

    return

main()

