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

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

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

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

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

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

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

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

m.x = c
m.z = c
m.v = h
d.v = i
j.u = b
j.q = h
b.x = j
b.v = h
b.z = g
c.u = i
c.q = h
h.v = m
g.u = i
g.q = h
e.u = i
e.q = h
i.x = e
i.v = h
i.z = g
n.u = b
n.q = h
assert d.v.x.u.x.q.v.v.v.txt == "m"