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

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

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

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

c = A("c")
g = B("g")
i = C("i")
l = D("l")
j = B("j")
e = C("e")
k = B("k")
f = A("f")
h = D("h")
d = C("d")

c.s = h
g.v = d
g.r = d
g.p = e
i.s = f
i.u = k
l.z = g
l.r = c
l.w = k
j.v = e
j.r = i
j.p = d
e.s = c
e.u = j
k.v = i
k.r = i
k.p = e
f.s = h
h.z = j
h.w = j
h.r = c
d.s = c
d.u = g
assert l.w.p.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

c = A("c")
g = B("g")
i = C("i")
l = D("l")
j = B("j")
e = C("e")
k = B("k")
f = A("f")
h = D("h")
d = C("d")

c.s = h
g.v = d
g.r = d
g.p = e
i.s = f
i.u = k
l.z = g
l.r = c
l.w = k
j.v = e
j.r = i
j.p = d
e.s = c
e.u = j
k.v = i
k.r = i
k.p = e
f.s = h
h.z = j
h.w = j
h.r = c
d.s = c
d.u = g
assert l.w.p.s.s.txt == "h"