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

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

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

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

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

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

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

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

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

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

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

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

g.s = a
g.z = m
e.r = m
e.y = m
e.s = l
e.v = a
e.q = a
m.s = g
a.y = g
a.v = g
c.t = g
c.s = g
c.q = m
c.z = m
l.t = g
l.s = g
l.q = m
l.z = m
assert m.s.z.s.s.y.z.txt == "m"