class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.q: B = None
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: D = None
        self.txt = txt

j = A("j")
k = B("k")
g = C("g")
l = D("l")
n = E("n")
e = B("e")
c = B("c")
i = A("i")

j.p = i
j.q = k
j.o = c
k.t = n
g.r = l
l.v = j
n.p = l
n.r = l
e.t = n
c.t = n
i.p = j
i.q = e
i.o = c
assert e.t.p.v.q.t.p.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.q: B = None
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: D = None
        self.txt = txt

j = A("j")
k = B("k")
g = C("g")
l = D("l")
n = E("n")
e = B("e")
c = B("c")
i = A("i")

j.p = i
j.q = k
j.o = c
k.t = n
g.r = l
l.v = j
n.p = l
n.r = l
e.t = n
c.t = n
i.p = j
i.q = e
i.o = c
assert e.t.p.v.q.t.p.v.q.txt == "k"