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

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

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

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

n.v = b
b.u = n
c.t = n
assert n.v.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

n.v = b
b.u = n
c.t = n
assert n.v.u.v.txt == "b"