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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: E = None
        self.q: A = None
        self.o: A = None
        self.txt = txt

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

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

j.u = d
j.t = e
j.q = b
b.z = j
k.y = f
d.s = b
d.r = i
d.q = j
d.o = j
h.q = k
h.y = f
e.z = j
f.z = j
i.q = k
i.y = f
assert j.t.z.q.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: B = None
        self.q: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: E = None
        self.q: A = None
        self.o: A = None
        self.txt = txt

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

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

j.u = d
j.t = e
j.q = b
b.z = j
k.y = f
d.s = b
d.r = i
d.q = j
d.o = j
h.q = k
h.y = f
e.z = j
f.z = j
i.q = k
i.y = f
assert j.t.z.q.z.u.txt == "d"