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

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

class C:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: D = None
        self.p: D = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: D = None
        self.p: D = None
        self.txt = txt

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

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

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