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

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

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

k = A("k")
j = B("j")
l = C("l")
a = B("a")
c = C("c")
b = B("b")

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

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

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

k = A("k")
j = B("j")
l = C("l")
a = B("a")
c = C("c")
b = B("b")

k.t = l
j.r = a
l.v = j
a.r = b
c.v = b
b.r = a
assert j.r.r.r.r.txt == "b"