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

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

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

f = A("f")
a = B("a")
n = C("n")
b = A("b")

f.w = n
f.x = n
f.u = a
a.y = f
n.y = f
n.t = b
n.z = a
b.w = n
b.x = n
b.u = a
assert f.x.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: B = None
        self.x: C = None
        self.txt = txt

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

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

f = A("f")
a = B("a")
n = C("n")
b = A("b")

f.w = n
f.x = n
f.u = a
a.y = f
n.y = f
n.t = b
n.z = a
b.w = n
b.x = n
b.u = a
assert f.x.y.x.txt == "n"