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

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

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

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

l = A("l")
a = B("a")
g = C("g")
e = D("e")
d = C("d")
m = A("m")

l.o = e
l.z = g
l.y = g
a.s = m
a.q = m
a.w = d
a.v = e
g.z = a
g.q = a
g.s = a
g.y = a
e.s = d
e.q = a
d.z = a
d.q = a
d.s = a
d.y = a
m.o = e
m.z = g
m.y = g
assert l.z.q.w.y.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.z: C = None
        self.y: C = None
        self.txt = txt

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

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

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

l = A("l")
a = B("a")
g = C("g")
e = D("e")
d = C("d")
m = A("m")

l.o = e
l.z = g
l.y = g
a.s = m
a.q = m
a.w = d
a.v = e
g.z = a
g.q = a
g.s = a
g.y = a
e.s = d
e.q = a
d.z = a
d.q = a
d.s = a
d.y = a
m.o = e
m.z = g
m.y = g
assert l.z.q.w.y.w.s.txt == "a"