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

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

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

g = A("g")
j = B("j")
a = C("a")
l = B("l")

g.u = l
g.v = l
j.o = g
j.z = l
a.y = g
l.o = g
l.z = j
assert j.o.u.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: B = None
        self.txt = txt

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

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

g = A("g")
j = B("j")
a = C("a")
l = B("l")

g.u = l
g.v = l
j.o = g
j.z = l
a.y = g
l.o = g
l.z = j
assert j.o.u.z.o.txt == "g"