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

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

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

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

k = A("k")
i = B("i")
b = C("b")
n = D("n")
e = D("e")
a = B("a")

k.r = b
i.v = k
i.y = a
b.o = e
b.u = k
n.v = e
n.r = e
e.v = n
e.r = n
a.v = k
a.y = i
assert k.r.o.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

k = A("k")
i = B("i")
b = C("b")
n = D("n")
e = D("e")
a = B("a")

k.r = b
i.v = k
i.y = a
b.o = e
b.u = k
n.v = e
n.r = e
e.v = n
e.r = n
a.v = k
a.y = i
assert k.r.o.v.v.v.txt == "n"