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

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

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

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

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

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

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

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

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

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

c.p = k
c.w = m
c.o = n
i.s = c
i.r = e
i.v = e
i.y = l
l.o = c
l.u = c
e.t = g
m.s = a
m.r = e
m.v = e
m.y = n
k.o = g
k.u = a
a.p = l
a.w = i
a.o = k
g.p = k
g.w = m
g.o = l
n.o = a
n.u = c
assert l.u.p.u.w.txt == "i"