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

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: A = None
        self.r: D = None
        self.txt = txt

j = A("j")
f = B("f")
g = C("g")
n = D("n")
h = E("h")
a = C("a")
m = A("m")
i = A("i")

j.z = a
j.x = i
f.r = n
f.v = j
g.s = a
g.x = a
g.q = a
n.v = a
h.s = f
h.p = i
h.r = n
a.s = g
a.x = g
a.q = g
m.z = g
m.x = i
i.z = a
i.x = m
assert n.v.s.x.s.s.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: A = None
        self.r: D = None
        self.txt = txt

j = A("j")
f = B("f")
g = C("g")
n = D("n")
h = E("h")
a = C("a")
m = A("m")
i = A("i")

j.z = a
j.x = i
f.r = n
f.v = j
g.s = a
g.x = a
g.q = a
n.v = a
h.s = f
h.p = i
h.r = n
a.s = g
a.x = g
a.q = g
m.z = g
m.x = i
i.z = a
i.x = m
assert n.v.s.x.s.s.x.q.txt == "a"