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

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

class C:
    def __init__(self, txt: str):
        self.u: F = None
        self.q: F = None
        self.v: D = None
        self.p: D = None
        self.x: F = None
        self.txt = txt

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

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

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

n = A("n")
m = B("m")
b = C("b")
j = D("j")
c = E("c")
d = F("d")

n.q = m
n.z = m
n.v = b
m.u = c
m.w = d
m.q = b
m.o = n
b.u = d
b.q = d
b.x = d
b.v = j
b.p = j
j.w = n
j.y = c
c.t = b
d.q = b
d.x = b
d.s = m
assert b.p.y.t.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: B = None
        self.v: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: F = None
        self.q: F = None
        self.v: D = None
        self.p: D = None
        self.x: F = None
        self.txt = txt

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

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

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

n = A("n")
m = B("m")
b = C("b")
j = D("j")
c = E("c")
d = F("d")

n.q = m
n.z = m
n.v = b
m.u = c
m.w = d
m.q = b
m.o = n
b.u = d
b.q = d
b.x = d
b.v = j
b.p = j
j.w = n
j.y = c
c.t = b
d.q = b
d.x = b
d.s = m
assert b.p.y.t.q.x.txt == "b"