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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: E = None
        self.z: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.u: E = None
        self.s: D = None
        self.y: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: C = None
        self.txt = txt

g = A("g")
m = B("m")
i = C("i")
e = D("e")
a = E("a")
f = F("f")

g.s = m
g.y = i
g.v = i
m.u = e
m.q = a
m.z = a
i.x = a
i.u = a
i.s = e
i.y = e
e.s = i
a.q = i
a.z = g
a.u = e
f.y = i
f.x = i
assert e.s.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: C = None
        self.v: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: E = None
        self.z: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.u: E = None
        self.s: D = None
        self.y: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: C = None
        self.txt = txt

g = A("g")
m = B("m")
i = C("i")
e = D("e")
a = E("a")
f = F("f")

g.s = m
g.y = i
g.v = i
m.u = e
m.q = a
m.z = a
i.x = a
i.u = a
i.s = e
i.y = e
e.s = i
a.q = i
a.z = g
a.u = e
f.y = i
f.x = i
assert e.s.y.s.txt == "i"