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

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: A = None
        self.o: C = None
        self.x: C = None
        self.txt = txt

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

e = A("e")
n = B("n")
k = C("k")
l = D("l")
d = A("d")
j = B("j")
m = D("m")
a = C("a")

e.t = n
n.o = j
n.s = l
n.w = d
n.r = a
k.u = e
k.y = d
k.o = a
k.x = a
l.u = e
d.t = j
j.o = n
j.s = m
j.w = d
j.r = a
m.u = e
a.u = e
a.y = d
a.o = k
a.x = k
assert a.y.t.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: A = None
        self.o: C = None
        self.x: C = None
        self.txt = txt

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

e = A("e")
n = B("n")
k = C("k")
l = D("l")
d = A("d")
j = B("j")
m = D("m")
a = C("a")

e.t = n
n.o = j
n.s = l
n.w = d
n.r = a
k.u = e
k.y = d
k.o = a
k.x = a
l.u = e
d.t = j
j.o = n
j.s = m
j.w = d
j.r = a
m.u = e
a.u = e
a.y = d
a.o = k
a.x = k
assert a.y.t.o.w.txt == "d"