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

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

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

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

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

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

l.s = k
h.q = c
e.v = g
e.y = k
e.x = c
g.r = l
g.w = e
g.z = c
c.o = l
c.r = l
j.r = k
j.w = e
j.z = c
i.q = c
n.q = c
k.s = l
assert g.w.y.s.s.s.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

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

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

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

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

l.s = k
h.q = c
e.v = g
e.y = k
e.x = c
g.r = l
g.w = e
g.z = c
c.o = l
c.r = l
j.r = k
j.w = e
j.z = c
i.q = c
n.q = c
k.s = l
assert g.w.y.s.s.s.s.s.s.s.txt == "l"