class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: E = None
        self.r: B = None
        self.u: C = None
        self.p: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: C = None
        self.x: D = None
        self.v: C = None
        self.txt = txt

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

h.q = e
h.u = e
h.y = j
h.p = j
h.r = g
g.w = h
e.w = c
e.t = h
b.p = h
b.o = h
b.y = j
b.w = e
b.z = c
j.q = h
j.o = c
j.v = c
j.x = b
c.w = e
c.t = h
assert g.w.r.w.u.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: E = None
        self.r: B = None
        self.u: C = None
        self.p: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: C = None
        self.x: D = None
        self.v: C = None
        self.txt = txt

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

h.q = e
h.u = e
h.y = j
h.p = j
h.r = g
g.w = h
e.w = c
e.t = h
b.p = h
b.o = h
b.y = j
b.w = e
b.z = c
j.q = h
j.o = c
j.v = c
j.x = b
c.w = e
c.t = h
assert g.w.r.w.u.t.q.txt == "e"