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

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

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

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

i = A("i")
a = B("a")
m = C("m")
n = D("n")
b = A("b")
f = D("f")
j = B("j")
g = C("g")
k = D("k")

i.r = j
a.w = k
a.s = m
a.o = n
a.v = g
m.x = g
m.s = g
m.z = a
n.w = f
n.x = m
b.r = j
f.w = k
f.x = g
j.w = f
j.s = g
j.o = k
j.v = m
g.x = m
g.s = m
g.z = j
k.w = f
k.x = g
assert a.s.z.o.x.s.x.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

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

i = A("i")
a = B("a")
m = C("m")
n = D("n")
b = A("b")
f = D("f")
j = B("j")
g = C("g")
k = D("k")

i.r = j
a.w = k
a.s = m
a.o = n
a.v = g
m.x = g
m.s = g
m.z = a
n.w = f
n.x = m
b.r = j
f.w = k
f.x = g
j.w = f
j.s = g
j.o = k
j.v = m
g.x = m
g.s = m
g.z = j
k.w = f
k.x = g
assert a.s.z.o.x.s.x.s.z.txt == "j"