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

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.t: A = None
        self.txt = txt

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

l = A("l")
c = B("c")
g = C("g")
j = D("j")
n = E("n")
a = A("a")
e = D("e")

l.w = a
l.q = a
c.y = e
c.q = g
c.w = n
g.r = c
g.o = a
j.r = n
j.t = a
n.v = j
n.u = j
a.w = l
a.q = l
e.r = n
e.t = a
assert g.o.w.w.q.q.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.q: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.t: A = None
        self.txt = txt

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

l = A("l")
c = B("c")
g = C("g")
j = D("j")
n = E("n")
a = A("a")
e = D("e")

l.w = a
l.q = a
c.y = e
c.q = g
c.w = n
g.r = c
g.o = a
j.r = n
j.t = a
n.v = j
n.u = j
a.w = l
a.q = l
e.r = n
e.t = a
assert g.o.w.w.q.q.w.w.txt == "a"