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

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

class C:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: B = None
        self.txt = txt

j = A("j")
b = B("b")
k = C("k")
g = A("g")
n = B("n")
l = B("l")
e = C("e")
h = B("h")
d = A("d")
c = C("c")

j.v = h
b.u = k
b.q = l
b.x = l
k.t = c
k.p = b
g.v = n
n.u = e
n.q = l
n.x = l
l.u = k
l.q = n
l.x = h
e.t = c
e.p = l
h.u = k
h.q = b
h.x = n
d.v = h
c.t = k
c.p = h
assert j.v.u.p.u.p.q.q.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: B = None
        self.txt = txt

j = A("j")
b = B("b")
k = C("k")
g = A("g")
n = B("n")
l = B("l")
e = C("e")
h = B("h")
d = A("d")
c = C("c")

j.v = h
b.u = k
b.q = l
b.x = l
k.t = c
k.p = b
g.v = n
n.u = e
n.q = l
n.x = l
l.u = k
l.q = n
l.x = h
e.t = c
e.p = l
h.u = k
h.q = b
h.x = n
d.v = h
c.t = k
c.p = h
assert j.v.u.p.u.p.q.q.u.p.txt == "l"