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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: E = None
        self.v: A = None
        self.x: B = None
        self.txt = txt

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

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

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

e = A("e")
j = B("j")
h = C("h")
f = D("f")
i = E("i")
a = B("a")
c = A("c")

e.s = i
j.u = f
j.p = i
j.v = e
j.x = a
h.q = c
h.y = c
h.v = i
h.x = j
h.t = e
f.q = h
f.r = i
f.t = i
f.v = a
i.r = f
a.u = f
a.p = i
a.v = e
a.x = j
c.s = i
assert f.t.r.r.r.v.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: E = None
        self.v: A = None
        self.x: B = None
        self.txt = txt

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

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

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

e = A("e")
j = B("j")
h = C("h")
f = D("f")
i = E("i")
a = B("a")
c = A("c")

e.s = i
j.u = f
j.p = i
j.v = e
j.x = a
h.q = c
h.y = c
h.v = i
h.x = j
h.t = e
f.q = h
f.r = i
f.t = i
f.v = a
i.r = f
a.u = f
a.p = i
a.v = e
a.x = j
c.s = i
assert f.t.r.r.r.v.u.q.txt == "h"