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

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: B = None
        self.txt = txt

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

i = A("i")
f = B("f")
a = C("a")
e = B("e")

i.u = a
i.x = a
f.s = e
f.w = e
a.v = i
a.t = i
e.s = f
e.w = f
assert f.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: B = None
        self.txt = txt

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

i = A("i")
f = B("f")
a = C("a")
e = B("e")

i.u = a
i.x = a
f.s = e
f.w = e
a.v = i
a.t = i
e.s = f
e.w = f
assert f.w.w.w.txt == "e"