class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: B = None
        self.p: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: A = None
        self.x: D = None
        self.s: C = None
        self.txt = txt

d = A("d")
b = B("b")
m = C("m")
e = D("e")
k = E("k")
f = A("f")
n = D("n")

d.y = k
d.v = b
d.p = b
b.o = e
m.q = b
m.t = b
e.r = n
e.z = n
e.t = m
e.w = b
k.z = d
k.v = f
k.x = n
k.s = m
f.y = k
f.v = b
f.p = b
n.r = e
n.z = e
n.t = m
n.w = b
assert b.o.t.t.o.w.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: B = None
        self.p: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: A = None
        self.x: D = None
        self.s: C = None
        self.txt = txt

d = A("d")
b = B("b")
m = C("m")
e = D("e")
k = E("k")
f = A("f")
n = D("n")

d.y = k
d.v = b
d.p = b
b.o = e
m.q = b
m.t = b
e.r = n
e.z = n
e.t = m
e.w = b
k.z = d
k.v = f
k.x = n
k.s = m
f.y = k
f.v = b
f.p = b
n.r = e
n.z = e
n.t = m
n.w = b
assert b.o.t.t.o.w.o.r.txt == "n"