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

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

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

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

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

d.y = h
d.w = l
d.s = e
b.r = g
b.w = e
e.o = l
e.q = l
e.s = l
l.v = e
a.r = n
a.w = h
n.r = a
n.w = h
h.o = l
h.q = l
h.s = l
g.r = a
g.w = e
assert b.w.s.v.q.v.q.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: D = None
        self.s: C = None
        self.txt = txt

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

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

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

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

d.y = h
d.w = l
d.s = e
b.r = g
b.w = e
e.o = l
e.q = l
e.s = l
l.v = e
a.r = n
a.w = h
n.r = a
n.w = h
h.o = l
h.q = l
h.s = l
g.r = a
g.w = e
assert b.w.s.v.q.v.q.v.o.txt == "l"