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

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

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: B = None
        self.txt = txt

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

l = A("l")
a = B("a")
k = C("k")
n = D("n")
d = C("d")
i = A("i")
j = D("j")
f = B("f")
g = B("g")

l.y = i
l.s = i
l.r = i
l.u = i
a.p = g
a.r = k
k.o = n
k.v = f
n.s = k
d.o = n
d.v = a
i.y = l
i.s = l
i.r = l
i.u = l
j.s = k
f.p = a
f.r = d
g.p = a
g.r = k
assert f.p.r.v.r.v.r.o.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: A = None
        self.r: A = None
        self.u: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: B = None
        self.txt = txt

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

l = A("l")
a = B("a")
k = C("k")
n = D("n")
d = C("d")
i = A("i")
j = D("j")
f = B("f")
g = B("g")

l.y = i
l.s = i
l.r = i
l.u = i
a.p = g
a.r = k
k.o = n
k.v = f
n.s = k
d.o = n
d.v = a
i.y = l
i.s = l
i.r = l
i.u = l
j.s = k
f.p = a
f.r = d
g.p = a
g.r = k
assert f.p.r.v.r.v.r.o.s.o.txt == "n"