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

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

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

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

l = A("l")
a = B("a")
n = C("n")
i = D("i")
f = B("f")
g = C("g")
b = B("b")
j = B("j")
e = B("e")

l.w = b
l.y = i
a.x = g
a.y = i
n.s = i
n.t = i
n.w = a
n.v = g
i.p = l
f.x = g
f.y = i
g.s = i
g.t = i
g.w = b
g.v = n
b.x = n
b.y = i
j.x = n
j.y = i
e.x = g
e.y = i
assert f.x.v.v.t.p.w.x.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: D = None
        self.txt = txt

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

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

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

l = A("l")
a = B("a")
n = C("n")
i = D("i")
f = B("f")
g = C("g")
b = B("b")
j = B("j")
e = B("e")

l.w = b
l.y = i
a.x = g
a.y = i
n.s = i
n.t = i
n.w = a
n.v = g
i.p = l
f.x = g
f.y = i
g.s = i
g.t = i
g.w = b
g.v = n
b.x = n
b.y = i
j.x = n
j.y = i
e.x = g
e.y = i
assert f.x.v.v.t.p.w.x.s.p.txt == "l"