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

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

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

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

l.x = f
l.p = f
l.w = n
n.t = f
n.v = f
n.s = l
f.u = n
assert n.s.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: C = None
        self.w: B = None
        self.txt = txt

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

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

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

l.x = f
l.p = f
l.w = n
n.t = f
n.v = f
n.s = l
f.u = n
assert n.s.p.u.txt == "n"