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

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

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

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

m = A("m")
f = B("f")
h = C("h")
b = D("b")
e = B("e")
l = C("l")
a = A("a")
k = D("k")
n = C("n")
i = D("i")

m.w = b
m.v = f
f.r = e
f.y = h
h.x = e
b.r = e
b.v = i
e.r = f
e.y = h
l.x = e
a.w = i
a.v = e
k.r = f
k.v = b
n.x = e
i.r = e
i.v = b
assert k.r.r.r.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: B = None
        self.txt = txt

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

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

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

m = A("m")
f = B("f")
h = C("h")
b = D("b")
e = B("e")
l = C("l")
a = A("a")
k = D("k")
n = C("n")
i = D("i")

m.w = b
m.v = f
f.r = e
f.y = h
h.x = e
b.r = e
b.v = i
e.r = f
e.y = h
l.x = e
a.w = i
a.v = e
k.r = f
k.v = b
n.x = e
i.r = e
i.v = b
assert k.r.r.r.r.y.txt == "h"