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

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

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

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

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

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

b.s = i
b.t = a
j.s = e
i.z = b
i.p = a
i.t = j
a.w = b
a.u = c
g.q = b
c.w = b
c.u = h
h.w = b
h.u = c
e.s = j
assert i.z.s.z.s.t.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.t: D = None
        self.txt = txt

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

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

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

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

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

b.s = i
b.t = a
j.s = e
i.z = b
i.p = a
i.t = j
a.w = b
a.u = c
g.q = b
c.w = b
c.u = h
h.w = b
h.u = c
e.s = j
assert i.z.s.z.s.t.s.s.s.txt == "e"