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

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.r: A = None
        self.v: A = None
        self.p: E = None
        self.t: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.u: B = None
        self.y: A = None
        self.o: A = None
        self.txt = txt

e = A("e")
h = B("h")
n = C("n")
m = D("m")
f = E("f")

e.o = n
e.x = f
e.z = m
e.v = m
h.s = f
n.s = m
n.r = e
n.v = e
n.p = f
n.t = h
m.z = e
f.s = e
f.y = e
f.o = e
f.u = h
assert m.z.o.s.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: E = None
        self.z: D = None
        self.v: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.r: A = None
        self.v: A = None
        self.p: E = None
        self.t: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.u: B = None
        self.y: A = None
        self.o: A = None
        self.txt = txt

e = A("e")
h = B("h")
n = C("n")
m = D("m")
f = E("f")

e.o = n
e.x = f
e.z = m
e.v = m
h.s = f
n.s = m
n.r = e
n.v = e
n.p = f
n.t = h
m.z = e
f.s = e
f.y = e
f.o = e
f.u = h
assert m.z.o.s.z.x.txt == "f"