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

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

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

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

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

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

e.r = b
e.x = a
e.w = f
a.q = f
a.r = h
a.s = l
a.z = l
h.z = a
h.w = f
h.u = b
b.y = a
b.p = e
b.o = h
b.x = g
b.v = g
l.u = f
g.u = e
f.r = b
f.x = a
f.w = e
assert a.q.w.w.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: B = None
        self.w: A = None
        self.txt = txt

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

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

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

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

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

e.r = b
e.x = a
e.w = f
a.q = f
a.r = h
a.s = l
a.z = l
h.z = a
h.w = f
h.u = b
b.y = a
b.p = e
b.o = h
b.x = g
b.v = g
l.u = f
g.u = e
f.r = b
f.x = a
f.w = e
assert a.q.w.w.r.p.txt == "e"