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

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

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

d = A("d")
l = B("l")
e = C("e")
h = B("h")
a = B("a")
j = A("j")
c = B("c")
n = A("n")
k = C("k")
b = B("b")

d.w = e
d.x = b
d.o = j
l.p = e
l.s = e
l.w = j
e.x = d
e.p = n
h.p = e
h.w = j
h.s = k
a.p = e
a.w = j
a.s = k
j.w = e
j.x = a
j.o = n
c.p = k
c.w = n
c.s = e
n.w = k
n.x = b
n.o = d
k.x = n
k.p = d
b.p = e
b.w = n
b.s = k
assert j.x.p.p.o.x.s.x.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.x: B = None
        self.o: A = None
        self.txt = txt

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

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

d = A("d")
l = B("l")
e = C("e")
h = B("h")
a = B("a")
j = A("j")
c = B("c")
n = A("n")
k = C("k")
b = B("b")

d.w = e
d.x = b
d.o = j
l.p = e
l.s = e
l.w = j
e.x = d
e.p = n
h.p = e
h.w = j
h.s = k
a.p = e
a.w = j
a.s = k
j.w = e
j.x = a
j.o = n
c.p = k
c.w = n
c.s = e
n.w = k
n.x = b
n.o = d
k.x = n
k.p = d
b.p = e
b.w = n
b.s = k
assert j.x.p.p.o.x.s.x.o.o.txt == "j"