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

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

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

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

e = A("e")
j = B("j")
g = C("g")
d = D("d")
l = D("l")
i = A("i")
h = B("h")
c = D("c")

e.v = d
e.p = h
j.p = g
j.s = l
g.x = j
g.w = e
d.u = g
d.y = g
l.u = g
l.y = g
i.v = d
i.p = h
h.p = g
h.s = c
c.u = g
c.y = g
assert j.s.y.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.p: B = None
        self.txt = txt

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

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

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

e = A("e")
j = B("j")
g = C("g")
d = D("d")
l = D("l")
i = A("i")
h = B("h")
c = D("c")

e.v = d
e.p = h
j.p = g
j.s = l
g.x = j
g.w = e
d.u = g
d.y = g
l.u = g
l.y = g
i.v = d
i.p = h
h.p = g
h.s = c
c.u = g
c.y = g
assert j.s.y.w.v.txt == "d"