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

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

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

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

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

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

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

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

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

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

e.p = g
e.u = g
e.x = b
e.z = d
d.y = k
d.q = k
d.r = e
h.w = i
h.s = f
h.z = e
g.y = k
g.x = l
g.z = b
k.y = d
k.q = d
k.r = n
n.p = g
n.u = g
n.x = f
n.z = d
b.w = e
b.z = e
b.s = f
i.p = g
i.u = g
i.x = b
i.z = k
l.w = e
l.z = e
l.s = f
f.w = i
f.z = i
f.s = b
assert f.s.z.u.z.w.x.z.z.y.txt == "k"