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

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.r: D = None
        self.txt = txt

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

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

h = A("h")
a = B("a")
l = C("l")
m = D("m")
g = E("g")
j = D("j")
b = E("b")
n = A("n")
k = E("k")
d = B("d")

h.o = d
h.q = d
h.s = l
a.y = n
a.v = g
l.t = b
l.r = m
m.u = h
m.s = j
g.p = a
g.w = h
j.u = n
j.s = m
b.p = a
b.w = h
n.o = d
n.q = d
n.s = l
k.p = d
k.w = h
d.y = n
d.v = b
assert j.u.q.v.w.s.r.s.s.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.q: B = None
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.r: D = None
        self.txt = txt

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

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

h = A("h")
a = B("a")
l = C("l")
m = D("m")
g = E("g")
j = D("j")
b = E("b")
n = A("n")
k = E("k")
d = B("d")

h.o = d
h.q = d
h.s = l
a.y = n
a.v = g
l.t = b
l.r = m
m.u = h
m.s = j
g.p = a
g.w = h
j.u = n
j.s = m
b.p = a
b.w = h
n.o = d
n.q = d
n.s = l
k.p = d
k.w = h
d.y = n
d.v = b
assert j.u.q.v.w.s.r.s.s.u.q.txt == "d"