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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: A = None
        self.txt = txt

n = A("n")
g = B("g")
m = C("m")
f = D("f")
i = E("i")
e = B("e")
l = D("l")
b = A("b")

n.z = b
n.w = m
g.z = e
g.o = l
g.p = l
g.v = m
g.q = b
m.x = l
m.t = i
f.t = l
f.w = e
f.u = e
i.w = n
i.r = b
e.z = g
e.o = l
e.v = m
e.q = n
e.p = f
l.t = f
l.w = g
l.u = g
b.z = n
b.w = m
assert b.z.w.t.w.z.z.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.w: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: A = None
        self.txt = txt

n = A("n")
g = B("g")
m = C("m")
f = D("f")
i = E("i")
e = B("e")
l = D("l")
b = A("b")

n.z = b
n.w = m
g.z = e
g.o = l
g.p = l
g.v = m
g.q = b
m.x = l
m.t = i
f.t = l
f.w = e
f.u = e
i.w = n
i.r = b
e.z = g
e.o = l
e.v = m
e.q = n
e.p = f
l.t = f
l.w = g
l.u = g
b.z = n
b.w = m
assert b.z.w.t.w.z.z.z.w.txt == "m"