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

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

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

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

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

j.v = d
j.r = d
j.z = c
n.x = c
n.o = c
n.u = i
n.w = g
c.w = g
l.s = d
i.x = c
i.o = c
i.u = d
i.w = l
d.x = c
d.o = c
d.u = i
d.w = g
g.s = i
assert d.u.u.o.w.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: C = None
        self.r: B = None
        self.txt = txt

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

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

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

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

j.v = d
j.r = d
j.z = c
n.x = c
n.o = c
n.u = i
n.w = g
c.w = g
l.s = d
i.x = c
i.o = c
i.u = d
i.w = l
d.x = c
d.o = c
d.u = i
d.w = g
g.s = i
assert d.u.u.o.w.s.w.txt == "l"