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

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

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

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

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

i = A("i")
d = B("d")
j = C("j")
f = D("f")
a = E("a")
m = D("m")
n = E("n")

i.z = d
i.y = f
d.y = n
d.v = n
d.x = n
d.z = m
j.w = f
j.z = f
j.o = d
j.x = i
f.r = d
f.z = n
f.o = a
a.x = n
a.o = d
a.z = f
m.r = d
m.z = a
m.o = a
n.x = a
n.o = d
n.z = m
assert i.z.z.r.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: D = None
        self.txt = txt

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

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

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

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

i = A("i")
d = B("d")
j = C("j")
f = D("f")
a = E("a")
m = D("m")
n = E("n")

i.z = d
i.y = f
d.y = n
d.v = n
d.x = n
d.z = m
j.w = f
j.z = f
j.o = d
j.x = i
f.r = d
f.z = n
f.o = a
a.x = n
a.o = d
a.z = f
m.r = d
m.z = a
m.o = a
n.x = a
n.o = d
n.z = m
assert i.z.z.r.v.z.txt == "m"