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

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

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

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

d = A("d")
n = B("n")
m = C("m")
g = D("g")

d.t = m
d.y = g
d.u = g
d.s = g
n.o = m
n.z = g
m.r = g
m.w = n
m.q = n
g.x = n
g.s = m
g.w = m
g.q = m
assert g.x.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.y: D = None
        self.u: D = None
        self.s: D = None
        self.txt = txt

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

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

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

d = A("d")
n = B("n")
m = C("m")
g = D("g")

d.t = m
d.y = g
d.u = g
d.s = g
n.o = m
n.z = g
m.r = g
m.w = n
m.q = n
g.x = n
g.s = m
g.w = m
g.q = m
assert g.x.o.w.txt == "n"