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

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

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

i = A("i")
a = B("a")
m = C("m")
n = A("n")
g = A("g")
e = B("e")

i.w = m
i.u = n
i.t = g
a.v = m
a.z = e
m.x = i
m.t = a
n.w = m
n.u = i
n.t = g
g.w = m
g.u = n
g.t = i
e.v = m
e.z = a
assert i.t.u.t.u.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: A = None
        self.t: A = None
        self.txt = txt

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

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

i = A("i")
a = B("a")
m = C("m")
n = A("n")
g = A("g")
e = B("e")

i.w = m
i.u = n
i.t = g
a.v = m
a.z = e
m.x = i
m.t = a
n.w = m
n.u = i
n.t = g
g.w = m
g.u = n
g.t = i
e.v = m
e.z = a
assert i.t.u.t.u.w.t.txt == "a"