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

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

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

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

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

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

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

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

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

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

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

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

k.y = b
k.s = b
k.x = l
k.t = h
l.p = m
l.s = m
m.x = n
m.q = l
d.w = h
d.p = n
a.u = d
n.y = l
n.x = l
n.s = b
n.t = h
h.w = d
h.p = k
b.p = m
b.s = m
c.u = h
e.p = m
e.s = m
assert d.w.w.w.p.t.w.w.p.txt == "k"