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

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

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

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

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

d = A("d")
l = B("l")
a = C("a")
c = D("c")
g = E("g")
e = D("e")

d.q = g
d.z = e
d.t = a
l.o = g
l.r = a
l.t = a
a.u = e
a.x = e
c.p = g
g.o = a
e.p = g
assert l.t.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: D = None
        self.t: C = None
        self.txt = txt

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

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

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

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

d = A("d")
l = B("l")
a = C("a")
c = D("c")
g = E("g")
e = D("e")

d.q = g
d.z = e
d.t = a
l.o = g
l.r = a
l.t = a
a.u = e
a.x = e
c.p = g
g.o = a
e.p = g
assert l.t.u.p.txt == "g"