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

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

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

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

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

h = A("h")
g = B("g")
a = C("a")
i = D("i")
b = E("b")
l = C("l")
k = E("k")
e = B("e")

h.t = a
h.q = e
h.r = i
g.p = h
a.y = i
a.x = g
a.q = l
a.v = l
i.p = b
i.w = a
b.w = e
l.y = i
l.x = e
l.q = a
l.v = a
k.w = g
e.p = h
assert k.w.p.q.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: B = None
        self.r: D = None
        self.txt = txt

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

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

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

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

h = A("h")
g = B("g")
a = C("a")
i = D("i")
b = E("b")
l = C("l")
k = E("k")
e = B("e")

h.t = a
h.q = e
h.r = i
g.p = h
a.y = i
a.x = g
a.q = l
a.v = l
i.p = b
i.w = a
b.w = e
l.y = i
l.x = e
l.q = a
l.v = a
k.w = g
e.p = h
assert k.w.p.q.p.t.txt == "a"