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

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

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

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

a = A("a")
c = B("c")
j = C("j")
d = D("d")
i = D("i")
b = B("b")
h = C("h")
m = B("m")
g = B("g")
e = C("e")

a.s = j
a.z = b
c.o = a
j.u = m
j.r = g
j.v = d
j.s = d
d.z = b
d.t = h
d.x = c
i.z = g
i.t = e
i.x = m
b.o = a
h.u = m
h.r = c
h.v = d
h.s = i
m.o = a
g.o = a
e.u = c
e.r = c
e.v = i
e.s = i
assert e.v.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: B = None
        self.txt = txt

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

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

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

a = A("a")
c = B("c")
j = C("j")
d = D("d")
i = D("i")
b = B("b")
h = C("h")
m = B("m")
g = B("g")
e = C("e")

a.s = j
a.z = b
c.o = a
j.u = m
j.r = g
j.v = d
j.s = d
d.z = b
d.t = h
d.x = c
i.z = g
i.t = e
i.x = m
b.o = a
h.u = m
h.r = c
h.v = d
h.s = i
m.o = a
g.o = a
e.u = c
e.r = c
e.v = i
e.s = i
assert e.v.z.o.txt == "a"