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

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

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

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

a = A("a")
b = B("b")
k = C("k")
g = D("g")
i = A("i")
e = C("e")
d = A("d")
h = B("h")

a.o = g
b.y = i
b.r = h
b.x = g
k.v = h
k.w = e
g.v = k
i.o = g
e.v = b
e.w = k
d.o = g
h.y = d
h.r = b
h.x = g
assert d.o.v.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

a = A("a")
b = B("b")
k = C("k")
g = D("g")
i = A("i")
e = C("e")
d = A("d")
h = B("h")

a.o = g
b.y = i
b.r = h
b.x = g
k.v = h
k.w = e
g.v = k
i.o = g
e.v = b
e.w = k
d.o = g
h.y = d
h.r = b
h.x = g
assert d.o.v.w.w.txt == "k"