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

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

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

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

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

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

a.z = j
f.v = e
f.t = k
i.p = d
i.q = d
k.o = e
c.r = d
c.p = f
c.z = f
c.s = k
e.o = k
j.p = c
j.q = c
h.r = d
h.p = f
h.z = f
h.s = e
m.z = i
d.r = h
d.p = f
d.z = f
d.s = e
assert e.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

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

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

a.z = j
f.v = e
f.t = k
i.p = d
i.q = d
k.o = e
c.r = d
c.p = f
c.z = f
c.s = k
e.o = k
j.p = c
j.q = c
h.r = d
h.p = f
h.z = f
h.s = e
m.z = i
d.r = h
d.p = f
d.z = f
d.s = e
assert e.o.o.o.o.o.txt == "k"