#sdpsgssolutions #Tag - 30% #AOI 2017 (Intermediate) # Open the input and output files. inputFile = open("tagin.txt", "r") outputFile = open("tagout.txt", "w") # Read N and M myInput = inputFile.readline().split() m = int(myInput[1]) # Create teams redTeam = [1] blueTeam = [2] # Input new tags into teams tagNumber = 1 while tagNumber <= m: myInput = inputFile.readline().split() if int(myInput[0]) in redTeam: redTeam.append(int(myInput[1])) else: blueTeam.append(int(myInput[1])) tagNumber = tagNumber + 1 # Output players outputFile.write(str(len(redTeam))+' '+str(len(blueTeam))) # Finally, close the input/output files. inputFile.close() outputFile.close()