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

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: C = None
        self.x: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: C = None
        self.x: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

a.p = e
a.y = e
a.s = h
a.q = i
e.y = c
e.p = h
e.w = h
e.x = b
h.y = b
h.q = a
h.w = k
b.w = e
b.v = a
b.r = i
b.o = c
i.w = c
i.z = e
c.y = e
c.p = h
c.w = h
c.x = b
k.w = c
k.z = c
assert b.w.w.w.w.y.y.txt == "c"