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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: D = None
        self.w: E = None
        self.q: C = None
        self.z: C = None
        self.s: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.p: F = None
        self.o: B = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: D = None
        self.w: E = None
        self.q: C = None
        self.z: C = None
        self.s: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.p: F = None
        self.o: B = None
        self.txt = txt

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

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

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

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

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