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

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

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

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

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

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

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

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

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

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

k.o = l
k.y = l
k.s = e
n.r = b
n.y = k
n.u = d
e.q = g
e.u = k
e.t = n
d.w = k
m.o = n
m.y = n
m.s = e
g.q = e
g.u = m
g.t = l
b.w = m
l.r = d
l.y = k
l.u = a
a.w = k
i.q = e
i.u = k
i.t = l
assert i.t.r.w.y.txt == "l"