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

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

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

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

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

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

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

l.q = a
l.w = b
c.t = b
m.w = b
b.p = c
b.o = l
f.v = m
f.z = m
f.s = l
f.q = c
a.u = m
a.w = b
assert m.w.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

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

l.q = a
l.w = b
c.t = b
m.w = b
b.p = c
b.o = l
f.v = m
f.z = m
f.s = l
f.q = c
a.u = m
a.w = b
assert m.w.o.q.txt == "a"