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

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

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

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

a.v = f
a.p = l
a.x = l
f.w = l
f.o = a
f.r = a
l.r = a
l.z = a
assert f.w.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: C = None
        self.x: C = None
        self.txt = txt

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

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

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

a.v = f
a.p = l
a.x = l
f.w = l
f.o = a
f.r = a
l.r = a
l.z = a
assert f.w.z.x.txt == "l"