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

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

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

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

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

n = A("n")
l = B("l")
g = C("g")
h = D("h")
b = E("b")
j = F("j")
a = D("a")

n.q = l
n.z = a
n.y = h
n.o = b
n.s = g
n.x = j
l.w = g
g.z = b
h.r = n
b.s = n
j.w = h
j.o = l
j.z = g
a.r = n
assert n.y.r.q.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: D = None
        self.y: D = None
        self.o: E = None
        self.s: C = None
        self.x: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

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

n = A("n")
l = B("l")
g = C("g")
h = D("h")
b = E("b")
j = F("j")
a = D("a")

n.q = l
n.z = a
n.y = h
n.o = b
n.s = g
n.x = j
l.w = g
g.z = b
h.r = n
b.s = n
j.w = h
j.o = l
j.z = g
a.r = n
assert n.y.r.q.w.z.txt == "b"