class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.x: C = None
        self.u: B = None
        self.z: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.o: A = None
        self.s: A = None
        self.w: F = None
        self.q: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.s: E = None
        self.txt = txt

b = A("b")
n = B("n")
j = C("j")
f = D("f")
e = E("e")
k = F("k")

b.q = n
b.u = n
b.x = j
b.z = f
n.z = b
j.x = n
j.o = b
j.s = b
j.w = k
j.q = e
f.w = e
e.w = b
e.t = k
e.p = n
e.x = n
e.y = n
k.x = b
k.s = e
assert e.t.s.t.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.x: C = None
        self.u: B = None
        self.z: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.o: A = None
        self.s: A = None
        self.w: F = None
        self.q: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.s: E = None
        self.txt = txt

b = A("b")
n = B("n")
j = C("j")
f = D("f")
e = E("e")
k = F("k")

b.q = n
b.u = n
b.x = j
b.z = f
n.z = b
j.x = n
j.o = b
j.s = b
j.w = k
j.q = e
f.w = e
e.w = b
e.t = k
e.p = n
e.x = n
e.y = n
k.x = b
k.s = e
assert e.t.s.t.s.p.txt == "n"