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

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.q: B = None
        self.p: A = None
        self.o: B = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.q: B = None
        self.p: A = None
        self.o: B = None
        self.y: C = None
        self.txt = txt

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

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

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

m.z = a
m.x = e
m.s = l
e.z = m
e.s = i
l.w = m
l.q = i
a.x = i
a.q = e
a.o = e
a.p = m
a.y = l
i.o = m
c.v = a
c.z = l
c.q = i
assert c.q.o.s.q.o.txt == "m"