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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.v: E = None
        self.o: D = None
        self.u: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.v: E = None
        self.o: D = None
        self.u: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

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

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

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

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