class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: E = None
        self.p: E = None
        self.r: D = None
        self.z: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: F = 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.t: A = None
        self.x: F = None
        self.r: C = None
        self.q: C = None
        self.y: B = None
        self.o: A = None
        self.txt = txt

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

n = A("n")
h = B("h")
i = C("i")
e = D("e")
k = E("k")
j = F("j")

n.s = h
n.q = k
n.p = k
n.r = e
n.z = j
h.o = n
h.z = n
h.y = e
i.z = j
e.u = i
k.t = n
k.o = n
k.x = j
k.r = i
k.q = i
k.y = h
j.z = n
assert n.q.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: E = None
        self.p: E = None
        self.r: D = None
        self.z: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: F = 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.t: A = None
        self.x: F = None
        self.r: C = None
        self.q: C = None
        self.y: B = None
        self.o: A = None
        self.txt = txt

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

n = A("n")
h = B("h")
i = C("i")
e = D("e")
k = E("k")
j = F("j")

n.s = h
n.q = k
n.p = k
n.r = e
n.z = j
h.o = n
h.z = n
h.y = e
i.z = j
e.u = i
k.t = n
k.o = n
k.x = j
k.r = i
k.q = i
k.y = h
j.z = n
assert n.q.q.z.txt == "j"