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

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

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.s: A = None
        self.u: C = None
        self.x: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: A = None
        self.u: B = None
        self.txt = txt

g = A("g")
i = B("i")
f = C("f")
c = D("c")
n = E("n")
e = D("e")
a = A("a")
b = E("b")
l = B("l")
h = B("h")

g.v = b
i.p = h
i.r = l
f.v = n
f.t = e
f.q = b
f.r = c
c.y = f
c.u = f
c.s = a
c.x = a
n.w = c
n.x = g
n.u = l
e.y = f
e.u = f
e.s = g
e.x = a
a.v = b
b.w = e
b.x = g
b.u = l
l.p = h
l.r = i
h.p = l
h.r = l
assert f.q.u.r.r.r.p.r.p.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.s: A = None
        self.u: C = None
        self.x: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: A = None
        self.u: B = None
        self.txt = txt

g = A("g")
i = B("i")
f = C("f")
c = D("c")
n = E("n")
e = D("e")
a = A("a")
b = E("b")
l = B("l")
h = B("h")

g.v = b
i.p = h
i.r = l
f.v = n
f.t = e
f.q = b
f.r = c
c.y = f
c.u = f
c.s = a
c.x = a
n.w = c
n.x = g
n.u = l
e.y = f
e.u = f
e.s = g
e.x = a
a.v = b
b.w = e
b.x = g
b.u = l
l.p = h
l.r = i
h.p = l
h.r = l
assert f.q.u.r.r.r.p.r.p.r.txt == "l"