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

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

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

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

i.w = g
g.u = a
j.t = g
j.v = a
j.y = i
a.w = g
assert j.t.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

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

i.w = g
g.u = a
j.t = g
j.v = a
j.y = i
a.w = g
assert j.t.u.w.txt == "g"