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

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

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

j = A("j")
a = B("a")
i = C("i")
f = C("f")

j.s = i
a.t = f
i.s = f
f.s = i
assert a.t.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

j = A("j")
a = B("a")
i = C("i")
f = C("f")

j.s = i
a.t = f
i.s = f
f.s = i
assert a.t.s.s.s.txt == "i"