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

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

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

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

n.w = j
n.v = e
n.y = e
h.y = e
h.p = e
k.o = h
j.y = e
j.p = e
e.w = j
e.v = n
e.y = n
d.o = j
a.o = j
i.o = h
assert j.y.w.y.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.v: A = None
        self.y: A = None
        self.txt = txt

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

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

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

n.w = j
n.v = e
n.y = e
h.y = e
h.p = e
k.o = h
j.y = e
j.p = e
e.w = j
e.v = n
e.y = n
d.o = j
a.o = j
i.o = h
assert j.y.w.y.w.p.txt == "e"