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

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

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

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

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

j = A("j")
d = B("d")
b = C("b")
e = D("e")
h = E("h")
g = A("g")

j.q = d
j.s = h
d.z = h
d.q = h
d.t = e
b.v = h
e.q = d
h.r = d
h.t = d
h.q = d
h.u = b
h.s = b
g.q = d
g.s = h
assert g.s.t.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: E = None
        self.txt = txt

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

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

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

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

j = A("j")
d = B("d")
b = C("b")
e = D("e")
h = E("h")
g = A("g")

j.q = d
j.s = h
d.z = h
d.q = h
d.t = e
b.v = h
e.q = d
h.r = d
h.t = d
h.q = d
h.u = b
h.s = b
g.q = d
g.s = h
assert g.s.t.t.q.txt == "d"