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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.q: A = None
        self.u: C = 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.q: C = None
        self.z: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: D = None
        self.txt = txt

a = A("a")
f = B("f")
b = C("b")
c = D("c")
n = E("n")
i = F("i")

a.s = n
a.y = i
f.r = a
f.q = a
f.u = b
b.s = a
c.q = b
c.z = a
n.q = c
i.o = a
i.r = c
assert c.z.s.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.y: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.q: A = None
        self.u: C = 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.q: C = None
        self.z: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: D = None
        self.txt = txt

a = A("a")
f = B("f")
b = C("b")
c = D("c")
n = E("n")
i = F("i")

a.s = n
a.y = i
f.r = a
f.q = a
f.u = b
b.s = a
c.q = b
c.z = a
n.q = c
i.o = a
i.r = c
assert c.z.s.q.z.txt == "a"