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

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

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

g = A("g")
k = B("k")
n = C("n")
d = B("d")
j = A("j")
i = A("i")
a = A("a")
l = C("l")
e = C("e")

g.v = e
k.v = e
k.r = l
k.o = d
n.p = k
n.x = k
d.v = e
d.r = e
d.o = k
j.v = n
i.v = n
a.v = n
l.p = d
l.x = k
e.p = d
e.x = d
assert k.r.p.v.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

g = A("g")
k = B("k")
n = C("n")
d = B("d")
j = A("j")
i = A("i")
a = A("a")
l = C("l")
e = C("e")

g.v = e
k.v = e
k.r = l
k.o = d
n.p = k
n.x = k
d.v = e
d.r = e
d.o = k
j.v = n
i.v = n
a.v = n
l.p = d
l.x = k
e.p = d
e.x = d
assert k.r.p.v.x.o.txt == "k"