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

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

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

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

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

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

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

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

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

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

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