#!env python

import csv

def main():
    with open('list.txt', mode='r') as fin, open('nodup.txt', mode='w') as fout:
        reader = csv.reader(fin, delimiter=';')
        for row in reader:
            known_elements = set()
            out = ';'.join(row[:3])
            for element in row[3:]:
                out += ';'
                if element not in known_elements:
                    out += element
                    known_elements.add(element)
            print(out, file=fout)

if __name__ == '__main__':
    main()
