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

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

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

l = A("l")
n = B("n")
k = C("k")
m = B("m")
b = B("b")
i = A("i")

l.t = i
n.o = b
k.r = i
k.s = m
m.o = n
b.o = m
i.t = l
assert k.r.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

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

l = A("l")
n = B("n")
k = C("k")
m = B("m")
b = B("b")
i = A("i")

l.t = i
n.o = b
k.r = i
k.s = m
m.o = n
b.o = m
i.t = l
assert k.r.t.t.txt == "i"