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

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: D = None
        self.r: C = 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.y: D = None
        self.u: C = None
        self.w: A = None
        self.txt = txt

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

g.s = n
g.z = m
m.p = i
m.x = j
m.r = c
i.o = j
j.y = n
j.u = i
j.w = g
c.o = n
n.y = j
n.u = c
n.w = g
assert g.s.w.z.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: D = None
        self.r: C = 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.y: D = None
        self.u: C = None
        self.w: A = None
        self.txt = txt

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

g.s = n
g.z = m
m.p = i
m.x = j
m.r = c
i.o = j
j.y = n
j.u = i
j.w = g
c.o = n
n.y = j
n.u = c
n.w = g
assert g.s.w.z.r.o.txt == "n"