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

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

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

e = A("e")
b = B("b")
c = C("c")
l = D("l")
a = E("a")
i = B("i")
g = B("g")

e.w = c
e.s = l
b.p = g
c.o = l
l.q = e
l.v = e
a.q = b
a.v = e
a.y = l
a.w = l
i.p = b
g.p = b
assert e.s.v.s.q.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.s: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

e = A("e")
b = B("b")
c = C("c")
l = D("l")
a = E("a")
i = B("i")
g = B("g")

e.w = c
e.s = l
b.p = g
c.o = l
l.q = e
l.v = e
a.q = b
a.v = e
a.y = l
a.w = l
i.p = b
g.p = b
assert e.s.v.s.q.s.q.txt == "e"