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

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

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

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

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

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

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

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

l.o = a
a.v = j
j.t = a
j.p = l
assert l.o.v.t.txt == "a"