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

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

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

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

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

f.z = l
i.v = a
d.w = f
c.p = f
c.y = i
c.v = i
m.w = l
h.p = n
h.y = i
h.v = i
n.z = f
a.p = n
a.y = i
a.v = i
l.z = f
e.p = f
e.y = i
e.v = i
assert l.z.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

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

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

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

f.z = l
i.v = a
d.w = f
c.p = f
c.y = i
c.v = i
m.w = l
h.p = n
h.y = i
h.v = i
n.z = f
a.p = n
a.y = i
a.v = i
l.z = f
e.p = f
e.y = i
e.v = i
assert l.z.z.z.z.z.z.txt == "l"