class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.s: A = None
        self.txt = txt

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

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

e = A("e")
h = B("h")
f = C("f")
j = C("j")
m = B("m")
d = A("d")
c = B("c")
n = B("n")
a = C("a")
b = A("b")

e.q = d
e.s = b
h.p = m
h.u = j
f.y = j
f.u = d
j.y = f
j.u = d
m.p = c
m.u = j
d.q = b
d.s = e
c.p = h
c.u = a
n.p = c
n.u = f
a.y = f
a.u = e
b.q = d
b.s = d
assert j.y.y.y.y.y.u.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.s: A = None
        self.txt = txt

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

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

e = A("e")
h = B("h")
f = C("f")
j = C("j")
m = B("m")
d = A("d")
c = B("c")
n = B("n")
a = C("a")
b = A("b")

e.q = d
e.s = b
h.p = m
h.u = j
f.y = j
f.u = d
j.y = f
j.u = d
m.p = c
m.u = j
d.q = b
d.s = e
c.p = h
c.u = a
n.p = c
n.u = f
a.y = f
a.u = e
b.q = d
b.s = d
assert j.y.y.y.y.y.u.s.q.txt == "d"