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

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

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.z: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: A = None
        self.v: D = None
        self.u: D = None
        self.txt = txt

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

b.q = f
b.r = j
c.p = b
c.s = l
j.t = f
j.z = b
l.u = j
m.y = c
f.r = j
f.s = b
f.v = l
f.u = l
assert m.y.s.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.r: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.z: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: A = None
        self.v: D = None
        self.u: D = None
        self.txt = txt

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

b.q = f
b.r = j
c.p = b
c.s = l
j.t = f
j.z = b
l.u = j
m.y = c
f.r = j
f.s = b
f.v = l
f.u = l
assert m.y.s.u.t.txt == "f"