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

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

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

i = A("i")
l = B("l")
h = C("h")
m = A("m")

i.t = m
i.y = m
l.p = m
l.o = m
h.s = m
h.r = l
m.t = i
m.y = i
assert i.y.y.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.y: A = None
        self.txt = txt

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

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

i = A("i")
l = B("l")
h = C("h")
m = A("m")

i.t = m
i.y = m
l.p = m
l.o = m
h.s = m
h.r = l
m.t = i
m.y = i
assert i.y.y.y.t.txt == "i"