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

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

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

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

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

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

b.q = k
b.z = l
b.r = c
c.q = n
c.r = k
n.q = k
n.v = j
g.x = a
g.u = a
g.p = a
g.y = j
j.s = k
a.x = g
a.u = g
a.p = g
a.y = j
e.q = n
e.r = n
k.q = n
k.v = j
l.q = k
l.z = b
l.r = e
assert n.v.s.v.s.v.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: A = None
        self.r: B = None
        self.txt = txt

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

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

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

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

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

b.q = k
b.z = l
b.r = c
c.q = n
c.r = k
n.q = k
n.v = j
g.x = a
g.u = a
g.p = a
g.y = j
j.s = k
a.x = g
a.u = g
a.p = g
a.y = j
e.q = n
e.r = n
k.q = n
k.v = j
l.q = k
l.z = b
l.r = e
assert n.v.s.v.s.v.s.v.txt == "j"