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

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

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

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

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

d.o = k
d.v = b
d.p = e
e.v = g
e.t = a
g.p = b
g.x = l
g.t = d
n.s = k
n.w = k
l.s = d
l.w = k
i.v = b
i.t = e
a.v = b
a.t = i
k.o = d
k.v = b
k.p = i
h.v = b
h.t = e
b.p = g
b.x = n
b.t = d
assert n.s.v.p.x.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: C = None
        self.p: B = None
        self.txt = txt

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

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

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

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

d.o = k
d.v = b
d.p = e
e.v = g
e.t = a
g.p = b
g.x = l
g.t = d
n.s = k
n.w = k
l.s = d
l.w = k
i.v = b
i.t = e
a.v = b
a.t = i
k.o = d
k.v = b
k.p = i
h.v = b
h.t = e
b.p = g
b.x = n
b.t = d
assert n.s.v.p.x.s.o.txt == "k"