fdIn = open('subsetSensors.txt', 'r')
#fdIn = open('SReadings.txt', 'r')
fdOut = open('subsetSensors_corrected.txt', 'w')
#fdOut = open('SReadings_corrected.txt', 'w')

sIDs = {}
for line in fdIn:
    l = line.split('\t')
    if l[0] not in sIDs:
        sIDs[l[0]] = [l[2], l[3], l[4]]
        fdOut.write(line)
        continue
    if l[2] != sIDs[l[0]][0] or  l[3] != sIDs[l[0]][1] or l[4] != sIDs[l[0]][2]:
        print l[0], l[1]
    else: fdOut.write(line)

fdIn.close()
fdOut.close()
