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

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

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

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

k = A("k")
m = B("m")
l = C("l")
e = D("e")
i = C("i")
g = B("g")
n = B("n")

k.o = m
m.v = i
m.t = e
m.r = n
l.v = m
l.p = e
e.r = i
e.z = i
e.p = k
e.y = k
i.v = g
i.p = e
g.v = l
g.t = e
g.r = n
n.v = i
n.t = e
n.r = g
assert i.p.p.o.v.p.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

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

k = A("k")
m = B("m")
l = C("l")
e = D("e")
i = C("i")
g = B("g")
n = B("n")

k.o = m
m.v = i
m.t = e
m.r = n
l.v = m
l.p = e
e.r = i
e.z = i
e.p = k
e.y = k
i.v = g
i.p = e
g.v = l
g.t = e
g.r = n
n.v = i
n.t = e
n.r = g
assert i.p.p.o.v.p.y.o.txt == "m"