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

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

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

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

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

n.o = h
n.w = i
f.u = e
a.y = b
h.u = a
h.v = n
h.p = k
c.u = e
i.u = e
i.v = b
i.p = c
k.u = e
e.y = b
b.o = h
b.w = h
assert c.u.y.o.u.y.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.w: D = None
        self.txt = txt

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

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

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

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

n.o = h
n.w = i
f.u = e
a.y = b
h.u = a
h.v = n
h.p = k
c.u = e
i.u = e
i.v = b
i.p = c
k.u = e
e.y = b
b.o = h
b.w = h
assert c.u.y.o.u.y.o.p.txt == "k"