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

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

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

a = A("a")
c = B("c")
m = C("m")
h = B("h")
b = B("b")
i = A("i")
l = C("l")
n = C("n")

a.w = m
a.z = i
c.t = a
m.z = l
m.o = h
m.w = n
h.t = i
b.t = i
i.w = m
i.z = a
l.z = m
l.w = m
l.o = b
n.z = l
n.w = l
n.o = c
assert i.w.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: A = None
        self.txt = txt

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

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

a = A("a")
c = B("c")
m = C("m")
h = B("h")
b = B("b")
i = A("i")
l = C("l")
n = C("n")

a.w = m
a.z = i
c.t = a
m.z = l
m.o = h
m.w = n
h.t = i
b.t = i
i.w = m
i.z = a
l.z = m
l.w = m
l.o = b
n.z = l
n.w = l
n.o = c
assert i.w.z.o.txt == "b"