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

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

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

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

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

c = A("c")
l = B("l")
k = C("k")
g = D("g")
n = E("n")
i = D("i")
a = B("a")
f = A("f")
b = A("b")

c.q = n
c.w = n
c.v = k
c.x = i
l.o = c
l.r = a
k.r = i
k.v = b
g.s = a
g.x = b
n.t = g
i.s = a
i.x = c
a.o = f
a.r = l
f.q = n
f.w = n
f.v = k
f.x = g
b.q = n
b.w = n
b.v = k
b.x = i
assert n.t.x.x.x.x.x.v.r.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.v: C = None
        self.w: E = None
        self.x: D = None
        self.txt = txt

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

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

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

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

c = A("c")
l = B("l")
k = C("k")
g = D("g")
n = E("n")
i = D("i")
a = B("a")
f = A("f")
b = A("b")

c.q = n
c.w = n
c.v = k
c.x = i
l.o = c
l.r = a
k.r = i
k.v = b
g.s = a
g.x = b
n.t = g
i.s = a
i.x = c
a.o = f
a.r = l
f.q = n
f.w = n
f.v = k
f.x = g
b.q = n
b.w = n
b.v = k
b.x = i
assert n.t.x.x.x.x.x.v.r.s.txt == "a"