Help me in solving VOTERS problem

My issue

How to reduce the time complexity of my code yet in the python

My code

# cook your dish here
l = []
res = []
a,b,c = list(map(int,input().split()))
for _ in range(0,(a+b+c)):
    num = int(input())
    if num not in l:
        l.append(num)
    else:
        res.append(num)
res = sorted(set(res))
for i in res:
    print(i)

Learning course: Roadmap to 3*
Problem Link: https://www.codechef.com/learn/course/klu-roadmap-3star/KLURMP300A/problems/VOTERS