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

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

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

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

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

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

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

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

i.u = f
i.s = f
e.s = f
e.p = f
f.x = e
f.w = g
f.u = g
g.u = f
g.s = f
assert e.p.x.p.txt == "f"