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

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

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

c = A("c")
i = B("i")
g = C("g")
l = B("l")
a = C("a")
m = B("m")
b = A("b")
e = A("e")

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

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

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

c = A("c")
i = B("i")
g = C("g")
l = B("l")
a = C("a")
m = B("m")
b = A("b")
e = A("e")

c.v = e
c.x = g
i.w = m
i.v = m
i.t = g
g.s = a
g.z = e
l.w = m
l.t = g
l.v = i
a.s = g
a.z = c
m.w = l
m.t = a
m.v = i
b.v = c
b.x = g
e.v = b
e.x = g
assert g.z.x.z.txt == "e"