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

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

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

k = A("k")
n = B("n")
h = C("h")
c = A("c")
l = B("l")
m = A("m")

k.s = l
k.t = l
n.t = h
n.z = m
n.u = m
h.r = m
h.o = l
h.s = l
c.s = l
c.t = l
l.t = h
l.z = c
l.u = k
m.s = n
m.t = n
assert m.s.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: B = None
        self.txt = txt

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

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

k = A("k")
n = B("n")
h = C("h")
c = A("c")
l = B("l")
m = A("m")

k.s = l
k.t = l
n.t = h
n.z = m
n.u = m
h.r = m
h.o = l
h.s = l
c.s = l
c.t = l
l.t = h
l.z = c
l.u = k
m.s = n
m.t = n
assert m.s.t.s.txt == "l"