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

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

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

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

j = A("j")
g = B("g")
m = C("m")
e = D("e")
l = B("l")
n = A("n")
d = C("d")
f = A("f")

j.o = e
g.w = e
m.w = e
m.t = d
e.r = l
e.v = m
e.w = m
l.w = e
n.o = e
d.w = e
d.t = m
f.o = e
assert n.o.v.t.w.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

j = A("j")
g = B("g")
m = C("m")
e = D("e")
l = B("l")
n = A("n")
d = C("d")
f = A("f")

j.o = e
g.w = e
m.w = e
m.t = d
e.r = l
e.v = m
e.w = m
l.w = e
n.o = e
d.w = e
d.t = m
f.o = e
assert n.o.v.t.w.v.w.txt == "e"