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

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

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

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

g.v = j
g.z = j
g.u = a
a.r = j
a.t = g
j.u = a
j.z = a
assert j.u.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.z: C = None
        self.u: B = None
        self.txt = txt

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

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

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

g.v = j
g.z = j
g.u = a
a.r = j
a.t = g
j.u = a
j.z = a
assert j.u.t.v.txt == "j"