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

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

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.q: C = None
        self.r: A = None
        self.v: B = None
        self.u: C = None
        self.txt = txt

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

i = A("i")
d = B("d")
e = C("e")
j = D("j")
l = E("l")
m = B("m")
h = B("h")

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

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

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.q: C = None
        self.r: A = None
        self.v: B = None
        self.u: C = None
        self.txt = txt

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

i = A("i")
d = B("d")
e = C("e")
j = D("j")
l = E("l")
m = B("m")
h = B("h")

i.q = j
i.z = d
d.y = j
e.o = i
j.w = e
j.q = e
j.u = e
j.r = i
j.v = d
l.t = d
l.s = e
l.q = j
m.y = j
h.y = j
assert h.y.v.y.r.z.txt == "d"