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

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: D = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: D = None
        self.txt = txt

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

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

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