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

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

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

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

j = A("j")
n = B("n")
i = C("i")
e = D("e")
k = C("k")
d = A("d")
c = D("c")
m = A("m")

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

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

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

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

j = A("j")
n = B("n")
i = C("i")
e = D("e")
k = C("k")
d = A("d")
c = D("c")
m = A("m")

j.r = e
j.w = e
j.y = n
n.o = m
n.s = j
i.p = e
i.u = e
i.t = c
i.o = j
e.r = m
k.p = c
k.t = c
k.u = e
k.o = m
d.r = e
d.y = n
d.w = c
c.r = m
m.r = e
m.w = e
m.y = n
assert m.r.r.w.txt == "e"