class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: C = None
        self.r: E = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

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

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

b.s = j
b.x = a
b.y = a
b.r = e
j.q = h
a.o = j
a.q = b
a.v = b
a.r = g
g.z = a
g.s = a
g.u = b
h.t = g
h.y = g
h.v = a
e.t = g
e.y = g
e.v = a
assert g.z.r.z.q.r.txt == "e"