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

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

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

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

l.y = c
l.w = d
c.r = e
e.t = j
e.w = g
d.t = e
d.w = h
a.r = n
g.y = c
g.w = d
h.y = a
h.w = j
i.t = n
i.w = l
j.t = n
j.w = l
n.t = d
n.w = h
assert a.r.t.t.w.w.w.y.r.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.w: C = None
        self.txt = txt

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

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

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

l.y = c
l.w = d
c.r = e
e.t = j
e.w = g
d.t = e
d.w = h
a.r = n
g.y = c
g.w = d
h.y = a
h.w = j
i.t = n
i.w = l
j.t = n
j.w = l
n.t = d
n.w = h
assert a.r.t.t.w.w.w.y.r.w.y.txt == "a"