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

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

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

j = A("j")
d = B("d")
h = C("h")
l = A("l")
c = B("c")
n = B("n")
g = B("g")
m = A("m")
i = A("i")
e = C("e")

j.x = e
j.v = e
j.q = l
d.z = c
d.t = g
h.t = l
h.w = d
l.x = h
l.v = h
l.q = j
c.z = g
c.t = n
n.z = d
n.t = g
g.z = d
g.t = c
m.x = e
m.v = e
m.q = i
i.x = h
i.v = h
i.q = l
e.t = j
e.w = c
assert m.q.v.t.q.q.q.x.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: A = None
        self.v: C = None
        self.txt = txt

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

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

j = A("j")
d = B("d")
h = C("h")
l = A("l")
c = B("c")
n = B("n")
g = B("g")
m = A("m")
i = A("i")
e = C("e")

j.x = e
j.v = e
j.q = l
d.z = c
d.t = g
h.t = l
h.w = d
l.x = h
l.v = h
l.q = j
c.z = g
c.t = n
n.z = d
n.t = g
g.z = d
g.t = c
m.x = e
m.v = e
m.q = i
i.x = h
i.v = h
i.q = l
e.t = j
e.w = c
assert m.q.v.t.q.q.q.x.w.z.txt == "g"