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

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

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

h = A("h")
b = B("b")
n = C("n")
e = A("e")
k = C("k")
j = B("j")
g = C("g")
i = C("i")
c = B("c")
a = C("a")

h.q = c
b.y = e
b.x = i
b.v = j
n.p = e
n.w = e
n.z = g
e.q = j
k.p = h
k.w = h
k.z = n
j.y = e
j.x = k
j.v = b
g.p = h
g.z = k
g.w = e
i.p = h
i.z = g
i.w = e
c.y = h
c.x = i
c.v = j
a.p = h
a.z = i
a.w = e
assert j.y.q.v.y.q.v.y.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

h = A("h")
b = B("b")
n = C("n")
e = A("e")
k = C("k")
j = B("j")
g = C("g")
i = C("i")
c = B("c")
a = C("a")

h.q = c
b.y = e
b.x = i
b.v = j
n.p = e
n.w = e
n.z = g
e.q = j
k.p = h
k.w = h
k.z = n
j.y = e
j.x = k
j.v = b
g.p = h
g.z = k
g.w = e
i.p = h
i.z = g
i.w = e
c.y = h
c.x = i
c.v = j
a.p = h
a.z = i
a.w = e
assert j.y.q.v.y.q.v.y.q.x.txt == "k"