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

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.y: D = None
        self.v: A = None
        self.t: D = None
        self.q: D = None
        self.txt = txt

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

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

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

n = A("n")
b = B("b")
i = C("i")
h = D("h")
c = E("c")
m = F("m")

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

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.y: D = None
        self.v: A = None
        self.t: D = None
        self.q: D = None
        self.txt = txt

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

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

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

n = A("n")
b = B("b")
i = C("i")
h = D("h")
c = E("c")
m = F("m")

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