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

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

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.y: E = None
        self.v: F = None
        self.s: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: C = None
        self.q: B = None
        self.p: E = None
        self.o: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

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

a = A("a")
h = B("h")
n = C("n")
i = D("i")
k = E("k")
b = F("b")

a.p = b
h.u = a
n.o = i
n.s = i
n.y = k
n.v = b
i.v = n
i.s = n
i.q = h
i.o = h
i.p = k
k.p = b
b.z = n
b.q = h
b.r = i
assert n.v.z.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.y: E = None
        self.v: F = None
        self.s: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: C = None
        self.q: B = None
        self.p: E = None
        self.o: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

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

a = A("a")
h = B("h")
n = C("n")
i = D("i")
k = E("k")
b = F("b")

a.p = b
h.u = a
n.o = i
n.s = i
n.y = k
n.v = b
i.v = n
i.s = n
i.q = h
i.o = h
i.p = k
k.p = b
b.z = n
b.q = h
b.r = i
assert n.v.z.s.s.txt == "n"