class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.o: A = None
        self.s: B = None
        self.txt = txt

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

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

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

n.x = f
n.o = f
n.s = b
b.z = d
d.x = f
d.v = n
d.u = b
f.x = n
f.o = n
f.s = b
assert b.z.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.o: A = None
        self.s: B = None
        self.txt = txt

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

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

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

n.x = f
n.o = f
n.s = b
b.z = d
d.x = f
d.v = n
d.u = b
f.x = n
f.o = n
f.s = b
assert b.z.u.z.txt == "d"