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

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.p: E = None
        self.w: D = None
        self.o: B = None
        self.t: E = None
        self.v: D = 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.p: F = None
        self.u: D = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.p: E = None
        self.w: D = None
        self.o: B = None
        self.t: E = None
        self.v: D = 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.p: F = None
        self.u: D = None
        self.txt = txt

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

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

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