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

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

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

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

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

i.o = k
i.w = a
i.z = e
j.z = k
j.s = m
g.q = k
g.v = m
m.r = a
m.v = a
m.o = i
m.s = b
k.o = i
k.w = m
k.z = l
c.o = k
c.w = a
c.z = e
e.q = i
e.v = a
a.r = m
a.v = m
a.o = c
a.s = b
l.q = c
l.v = a
b.z = i
b.s = a
assert e.q.w.s.z.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: D = None
        self.z: C = None
        self.txt = txt

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

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

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

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

i.o = k
i.w = a
i.z = e
j.z = k
j.s = m
g.q = k
g.v = m
m.r = a
m.v = a
m.o = i
m.s = b
k.o = i
k.w = m
k.z = l
c.o = k
c.w = a
c.z = e
e.q = i
e.v = a
a.r = m
a.v = m
a.o = c
a.s = b
l.q = c
l.v = a
b.z = i
b.s = a
assert e.q.w.s.z.w.v.txt == "m"