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

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

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

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

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

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

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

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

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

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

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