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

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

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

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

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

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

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

b.p = m
b.s = m
b.w = i
b.t = a
b.u = a
n.t = m
n.q = m
n.v = b
n.s = a
a.x = n
i.s = a
f.w = b
f.p = b
f.y = a
f.q = a
m.z = a
m.x = a
assert b.w.s.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.s: F = None
        self.w: D = None
        self.t: C = None
        self.u: C = None
        self.txt = txt

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

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

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

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

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

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

b.p = m
b.s = m
b.w = i
b.t = a
b.u = a
n.t = m
n.q = m
n.v = b
n.s = a
a.x = n
i.s = a
f.w = b
f.p = b
f.y = a
f.q = a
m.z = a
m.x = a
assert b.w.s.x.s.txt == "a"