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

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

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

h = A("h")
n = B("n")
e = C("e")
g = C("g")
k = A("k")

h.z = k
h.t = k
h.x = k
n.s = k
n.q = g
e.x = n
g.x = n
k.z = h
k.t = h
k.x = h
assert e.x.q.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: A = None
        self.x: A = None
        self.txt = txt

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

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

h = A("h")
n = B("n")
e = C("e")
g = C("g")
k = A("k")

h.z = k
h.t = k
h.x = k
n.s = k
n.q = g
e.x = n
g.x = n
k.z = h
k.t = h
k.x = h
assert e.x.q.x.q.txt == "g"