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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: E = None
        self.q: C = None
        self.x: E = None
        self.t: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: E = None
        self.p: E = None
        self.o: C = None
        self.txt = txt

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

i = A("i")
l = B("l")
d = C("d")
b = D("b")
e = E("e")
g = C("g")
f = E("f")
n = E("n")

i.o = l
i.q = l
i.x = d
l.u = b
l.v = f
l.q = d
l.x = e
l.t = i
d.q = b
d.w = i
d.u = l
b.r = l
b.q = f
b.p = f
b.o = g
e.o = f
e.u = l
e.y = l
e.w = l
g.q = b
g.w = i
g.u = l
f.o = n
f.u = l
f.y = l
f.w = l
n.o = e
n.u = l
n.y = l
n.w = l
assert f.o.w.q.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.x: C = None
        self.q: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: E = None
        self.q: C = None
        self.x: E = None
        self.t: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: E = None
        self.p: E = None
        self.o: C = None
        self.txt = txt

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

i = A("i")
l = B("l")
d = C("d")
b = D("b")
e = E("e")
g = C("g")
f = E("f")
n = E("n")

i.o = l
i.q = l
i.x = d
l.u = b
l.v = f
l.q = d
l.x = e
l.t = i
d.q = b
d.w = i
d.u = l
b.r = l
b.q = f
b.p = f
b.o = g
e.o = f
e.u = l
e.y = l
e.w = l
g.q = b
g.w = i
g.u = l
f.o = n
f.u = l
f.y = l
f.w = l
n.o = e
n.u = l
n.y = l
n.w = l
assert f.o.w.q.q.r.txt == "l"