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

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

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

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

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

e.r = a
e.v = a
e.p = f
l.y = f
h.z = k
a.y = l
i.z = l
f.y = k
k.y = f
assert f.y.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: D = None
        self.p: D = None
        self.txt = txt

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

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

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

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

e.r = a
e.v = a
e.p = f
l.y = f
h.z = k
a.y = l
i.z = l
f.y = k
k.y = f
assert f.y.y.y.y.y.y.txt == "f"