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

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

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

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

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

h.x = j
h.r = k
h.z = f
k.u = c
k.s = i
l.r = k
l.w = h
c.q = i
j.r = k
j.w = g
g.x = l
g.r = k
g.z = h
f.x = j
f.r = k
f.z = n
n.x = j
n.r = k
n.z = h
i.q = c
assert h.x.r.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: B = None
        self.z: A = None
        self.txt = txt

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

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

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

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

h.x = j
h.r = k
h.z = f
k.u = c
k.s = i
l.r = k
l.w = h
c.q = i
j.r = k
j.w = g
g.x = l
g.r = k
g.z = h
f.x = j
f.r = k
f.z = n
n.x = j
n.r = k
n.z = h
i.q = c
assert h.x.r.s.q.txt == "c"