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

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

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

i = A("i")
h = B("h")
g = C("g")
e = A("e")

i.q = g
i.t = e
i.y = e
h.s = g
h.u = i
g.z = i
g.t = h
e.q = g
e.t = i
e.y = i
assert i.y.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.t: A = None
        self.y: A = None
        self.txt = txt

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

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

i = A("i")
h = B("h")
g = C("g")
e = A("e")

i.q = g
i.t = e
i.y = e
h.s = g
h.u = i
g.z = i
g.t = h
e.q = g
e.t = i
e.y = i
assert i.y.y.q.txt == "g"