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

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

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

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

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

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

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

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

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