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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.q: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: A = None
        self.y: E = None
        self.p: A = None
        self.z: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.o: D = None
        self.x: C = None
        self.q: D = None
        self.txt = txt

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

k.q = e
j.u = h
j.q = d
d.r = j
d.z = j
d.x = k
d.p = k
d.y = l
g.v = d
l.s = h
l.o = g
l.x = d
l.q = c
b.v = d
e.v = d
c.v = d
h.r = j
h.z = j
h.x = k
h.p = k
h.y = l
i.s = d
i.o = g
i.q = g
i.x = h
assert l.q.v.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.q: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: A = None
        self.y: E = None
        self.p: A = None
        self.z: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.o: D = None
        self.x: C = None
        self.q: D = None
        self.txt = txt

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

k.q = e
j.u = h
j.q = d
d.r = j
d.z = j
d.x = k
d.p = k
d.y = l
g.v = d
l.s = h
l.o = g
l.x = d
l.q = c
b.v = d
e.v = d
c.v = d
h.r = j
h.z = j
h.x = k
h.p = k
h.y = l
i.s = d
i.o = g
i.q = g
i.x = h
assert l.q.v.p.q.txt == "e"