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

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

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

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

d = A("d")
n = B("n")
b = C("b")
i = D("i")
m = D("m")
e = B("e")
a = D("a")

d.v = n
d.x = e
n.s = e
n.z = i
n.y = a
n.t = b
b.x = e
i.o = m
m.o = i
e.s = n
e.z = i
e.y = a
e.t = b
a.o = i
assert m.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: B = None
        self.txt = txt

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

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

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

d = A("d")
n = B("n")
b = C("b")
i = D("i")
m = D("m")
e = B("e")
a = D("a")

d.v = n
d.x = e
n.s = e
n.z = i
n.y = a
n.t = b
b.x = e
i.o = m
m.o = i
e.s = n
e.z = i
e.y = a
e.t = b
a.o = i
assert m.o.o.o.o.o.txt == "i"