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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.z: C = None
        self.u: B = None
        self.txt = txt

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

n = A("n")
k = B("k")
b = C("b")
m = A("m")
i = C("i")
d = B("d")
e = A("e")
h = C("h")

n.s = i
k.v = b
k.z = b
k.u = d
b.x = h
m.s = i
i.x = h
d.v = b
d.z = b
d.u = k
e.s = b
h.x = i
assert m.s.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.z: C = None
        self.u: B = None
        self.txt = txt

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

n = A("n")
k = B("k")
b = C("b")
m = A("m")
i = C("i")
d = B("d")
e = A("e")
h = C("h")

n.s = i
k.v = b
k.z = b
k.u = d
b.x = h
m.s = i
i.x = h
d.v = b
d.z = b
d.u = k
e.s = b
h.x = i
assert m.s.x.x.x.x.txt == "i"