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

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

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

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

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

h.s = c
h.q = k
h.u = n
k.y = a
k.w = l
k.z = n
n.y = k
n.w = l
n.t = a
n.p = a
d.q = n
a.q = j
j.y = k
j.w = l
j.t = d
j.p = a
g.s = h
g.q = k
g.u = n
l.y = k
l.w = j
l.t = d
l.p = d
c.s = h
c.q = k
c.u = l
assert j.t.q.w.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.q: B = None
        self.u: C = None
        self.txt = txt

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

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

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

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

h.s = c
h.q = k
h.u = n
k.y = a
k.w = l
k.z = n
n.y = k
n.w = l
n.t = a
n.p = a
d.q = n
a.q = j
j.y = k
j.w = l
j.t = d
j.p = a
g.s = h
g.q = k
g.u = n
l.y = k
l.w = j
l.t = d
l.p = d
c.s = h
c.q = k
c.u = l
assert j.t.q.w.y.w.txt == "l"