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

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

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

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

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

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

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

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

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

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

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