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

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

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

a = A("a")
b = B("b")
f = C("f")
l = A("l")
e = B("e")
g = B("g")

a.s = g
a.w = l
a.x = f
b.o = l
b.y = e
b.u = a
f.o = a
f.v = e
f.r = l
l.s = e
l.w = a
l.x = f
e.o = a
e.u = a
e.y = b
g.o = l
g.u = l
g.y = b
assert f.v.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: A = None
        self.x: C = None
        self.txt = txt

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

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

a = A("a")
b = B("b")
f = C("f")
l = A("l")
e = B("e")
g = B("g")

a.s = g
a.w = l
a.x = f
b.o = l
b.y = e
b.u = a
f.o = a
f.v = e
f.r = l
l.s = e
l.w = a
l.x = f
e.o = a
e.u = a
e.y = b
g.o = l
g.u = l
g.y = b
assert f.v.u.x.txt == "f"