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

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

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

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

e.z = g
e.u = g
f.u = g
f.o = g
f.z = e
l.r = e
l.s = g
g.u = f
g.o = f
g.z = e
assert e.u.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: B = None
        self.txt = txt

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

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

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

e.z = g
e.u = g
f.u = g
f.o = g
f.z = e
l.r = e
l.s = g
g.u = f
g.o = f
g.z = e
assert e.u.o.z.txt == "e"