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

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

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

l = A("l")
i = B("i")
c = C("c")
a = B("a")

l.s = i
i.p = l
i.y = l
i.t = c
c.t = i
c.u = a
a.p = l
a.y = l
a.t = c
assert c.t.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

l = A("l")
i = B("i")
c = C("c")
a = B("a")

l.s = i
i.p = l
i.y = l
i.t = c
c.t = i
c.u = a
a.p = l
a.y = l
a.t = c
assert c.t.p.s.txt == "i"