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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.o: A = None
        self.v: A = None
        self.y: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

i = A("i")
n = B("n")
l = C("l")
g = D("g")
a = E("a")

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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.o: A = None
        self.v: A = None
        self.y: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

i = A("i")
n = B("n")
l = C("l")
g = D("g")
a = E("a")

i.u = n
i.w = n
n.t = i
n.o = i
n.v = i
n.y = i
l.v = g
l.w = g
l.s = a
l.u = n
g.t = i
g.q = i
a.r = l
assert g.q.w.o.w.txt == "n"