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

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: A = None
        self.r: E = None
        self.w: A = None
        self.p: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.t: B = None
        self.r: B = None
        self.s: C = None
        self.p: A = None
        self.txt = txt

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

a.s = m
a.y = n
a.p = n
a.w = c
m.y = a
c.q = m
c.t = a
c.w = a
c.r = d
c.p = b
b.o = m
d.w = m
n.x = d
n.t = m
n.r = m
n.s = c
n.p = a
i.w = m
assert a.s.y.s.y.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: F = None
        self.w: C = None
        self.p: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: A = None
        self.r: E = None
        self.w: A = None
        self.p: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.t: B = None
        self.r: B = None
        self.s: C = None
        self.p: A = None
        self.txt = txt

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

a.s = m
a.y = n
a.p = n
a.w = c
m.y = a
c.q = m
c.t = a
c.w = a
c.r = d
c.p = b
b.o = m
d.w = m
n.x = d
n.t = m
n.r = m
n.s = c
n.p = a
i.w = m
assert a.s.y.s.y.s.y.txt == "a"