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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: C = None
        self.t: B = None
        self.x: B = None
        self.o: D = None
        self.txt = txt

j = A("j")
m = B("m")
i = C("i")
e = D("e")
h = E("h")
k = D("k")
a = E("a")
g = C("g")

j.o = e
j.p = e
j.q = k
m.u = j
i.v = h
i.t = m
e.r = h
e.p = j
h.y = k
h.w = i
h.t = m
h.x = m
h.o = e
k.r = a
k.p = j
a.y = k
a.o = k
a.w = i
a.t = m
a.x = m
g.v = a
g.t = m
assert j.p.p.q.p.q.r.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: D = None
        self.p: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: C = None
        self.t: B = None
        self.x: B = None
        self.o: D = None
        self.txt = txt

j = A("j")
m = B("m")
i = C("i")
e = D("e")
h = E("h")
k = D("k")
a = E("a")
g = C("g")

j.o = e
j.p = e
j.q = k
m.u = j
i.v = h
i.t = m
e.r = h
e.p = j
h.y = k
h.w = i
h.t = m
h.x = m
h.o = e
k.r = a
k.p = j
a.y = k
a.o = k
a.w = i
a.t = m
a.x = m
g.v = a
g.t = m
assert j.p.p.q.p.q.r.o.r.txt == "a"