class A:
    def __init__(self, txt: str):
        self.x: C = 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.r: E = None
        self.y: A = None
        self.p: D = None
        self.txt = txt

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

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

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

f.x = e
i.v = k
e.r = a
e.y = f
e.p = k
k.y = a
k.s = l
a.z = m
a.s = e
m.v = l
n.r = a
n.y = f
n.p = k
l.y = a
l.s = k
assert m.v.y.s.y.x.r.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = 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.r: E = None
        self.y: A = None
        self.p: D = None
        self.txt = txt

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

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

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

f.x = e
i.v = k
e.r = a
e.y = f
e.p = k
k.y = a
k.s = l
a.z = m
a.s = e
m.v = l
n.r = a
n.y = f
n.p = k
l.y = a
l.s = k
assert m.v.y.s.y.x.r.s.y.txt == "f"