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

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

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

n = A("n")
f = B("f")
l = C("l")
b = C("b")
c = C("c")

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

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

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

n = A("n")
f = B("f")
l = C("l")
b = C("b")
c = C("c")

n.v = b
f.t = n
l.r = f
b.r = f
c.r = f
assert f.t.v.r.txt == "f"