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

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

a = A("a")
c = B("c")
l = B("l")
j = B("j")

a.t = j
c.r = l
l.r = c
j.r = l
assert a.t.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

a = A("a")
c = B("c")
l = B("l")
j = B("j")

a.t = j
c.r = l
l.r = c
j.r = l
assert a.t.r.r.txt == "c"