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

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.s: B = None
        self.u: A = None
        self.x: C = None
        self.q: B = 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.u: E = None
        self.o: B = None
        self.q: C = None
        self.txt = txt

l = A("l")
a = B("a")
c = C("c")
d = D("d")
f = E("f")
b = F("b")

l.y = a
a.t = c
c.y = d
c.w = f
c.u = l
d.o = l
d.u = l
d.s = a
d.q = a
d.x = c
f.q = d
b.u = f
b.o = a
b.q = c
assert a.t.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.s: B = None
        self.u: A = None
        self.x: C = None
        self.q: B = 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.u: E = None
        self.o: B = None
        self.q: C = None
        self.txt = txt

l = A("l")
a = B("a")
c = C("c")
d = D("d")
f = E("f")
b = F("b")

l.y = a
a.t = c
c.y = d
c.w = f
c.u = l
d.o = l
d.u = l
d.s = a
d.q = a
d.x = c
f.q = d
b.u = f
b.o = a
b.q = c
assert a.t.y.s.txt == "a"