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

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

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: B = None
        self.r: C = None
        self.q: A = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: B = None
        self.r: C = None
        self.q: A = None
        self.txt = txt

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

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