Excessive time consumption of python

from collections import defaultdict as dd

for _ in range(int(input())):
n=int(input())
p1,p2,p3=map(int,input().split())
dic=dd(list)
lis=[]

for i in range(n-1):
    a,b=map(int,input().split())
    lis.append(a)
lis.append(b)

.
.
.
.
no doubt it is giving wrong answer but the question is python pypy 3.5 is taking 2.8sec approx just to solve this ?
N=10^5 maximum so why these statements taking so much time ?
please explain someone