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

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

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

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

j = A("j")
f = B("f")
i = C("i")
h = D("h")
e = B("e")
l = C("l")
m = A("m")

j.r = i
j.y = h
j.p = e
j.x = e
f.v = e
i.w = h
i.v = l
i.z = e
h.y = j
e.v = f
l.w = h
l.v = i
l.z = e
m.r = i
m.y = h
m.p = e
m.x = e
assert e.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: D = None
        self.p: B = None
        self.x: B = None
        self.txt = txt

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

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

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

j = A("j")
f = B("f")
i = C("i")
h = D("h")
e = B("e")
l = C("l")
m = A("m")

j.r = i
j.y = h
j.p = e
j.x = e
f.v = e
i.w = h
i.v = l
i.z = e
h.y = j
e.v = f
l.w = h
l.v = i
l.z = e
m.r = i
m.y = h
m.p = e
m.x = e
assert e.v.v.v.v.txt == "e"