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

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

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

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

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

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

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

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

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

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

l.z = c
l.w = f
l.x = j
a.q = e
a.w = m
a.s = i
a.o = c
m.z = j
m.s = j
e.r = c
e.q = i
e.z = m
c.z = l
c.w = i
c.x = j
j.z = m
j.s = m
f.r = c
f.q = e
f.z = m
g.q = e
g.w = j
g.s = f
g.o = c
i.r = c
i.q = e
i.z = j
n.q = e
n.w = m
n.s = f
n.o = l
assert l.z.x.s.z.z.txt == "m"