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

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

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

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

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

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

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

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

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

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

g.r = j
g.u = j
g.t = l
g.y = m
m.w = f
m.o = f
m.x = n
m.z = j
l.y = f
j.u = l
j.q = l
f.w = m
f.o = m
f.x = n
f.z = j
n.r = j
n.u = j
n.t = l
n.y = m
assert m.z.u.y.o.w.z.txt == "j"