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

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

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

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

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

a = A("a")
j = B("j")
m = C("m")
i = D("i")
f = E("f")
d = E("d")
h = C("h")
e = A("e")
g = D("g")

a.z = i
j.z = h
m.v = i
m.t = h
m.x = f
m.r = d
i.w = f
i.v = h
i.o = g
f.q = j
d.q = j
h.v = g
h.t = m
h.x = d
h.r = d
e.z = g
g.w = d
g.v = m
g.o = i
assert j.z.r.q.z.v.o.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

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

a = A("a")
j = B("j")
m = C("m")
i = D("i")
f = E("f")
d = E("d")
h = C("h")
e = A("e")
g = D("g")

a.z = i
j.z = h
m.v = i
m.t = h
m.x = f
m.r = d
i.w = f
i.v = h
i.o = g
f.q = j
d.q = j
h.v = g
h.t = m
h.x = d
h.r = d
e.z = g
g.w = d
g.v = m
g.o = i
assert j.z.r.q.z.v.o.v.v.v.txt == "m"