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

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

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

n = A("n")
d = B("d")
k = C("k")
j = C("j")
c = A("c")
h = A("h")
a = B("a")
b = B("b")
i = A("i")
m = A("m")

n.r = d
n.v = c
n.o = j
d.w = b
d.s = k
d.x = a
k.q = b
k.s = j
j.q = a
j.s = k
c.r = a
c.v = i
c.o = j
h.r = d
h.v = n
h.o = k
a.w = b
a.x = b
a.s = j
b.w = a
b.s = j
b.x = d
i.r = a
i.v = m
i.o = k
m.r = a
m.v = h
m.o = j
assert n.r.s.q.x.s.s.s.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.v: A = None
        self.o: C = None
        self.txt = txt

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

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

n = A("n")
d = B("d")
k = C("k")
j = C("j")
c = A("c")
h = A("h")
a = B("a")
b = B("b")
i = A("i")
m = A("m")

n.r = d
n.v = c
n.o = j
d.w = b
d.s = k
d.x = a
k.q = b
k.s = j
j.q = a
j.s = k
c.r = a
c.v = i
c.o = j
h.r = d
h.v = n
h.o = k
a.w = b
a.x = b
a.s = j
b.w = a
b.s = j
b.x = d
i.r = a
i.v = m
i.o = k
m.r = a
m.v = h
m.o = j
assert n.r.s.q.x.s.s.s.q.w.txt == "a"