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

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

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

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

m = A("m")
h = B("h")
i = C("i")
g = D("g")
n = B("n")

m.w = i
m.z = i
m.v = i
h.z = m
i.o = g
g.z = n
g.q = i
g.u = h
n.z = m
assert i.o.q.o.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: C = None
        self.v: C = None
        self.txt = txt

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

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

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

m = A("m")
h = B("h")
i = C("i")
g = D("g")
n = B("n")

m.w = i
m.z = i
m.v = i
h.z = m
i.o = g
g.z = n
g.q = i
g.u = h
n.z = m
assert i.o.q.o.u.z.txt == "m"