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

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

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

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

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

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

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

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

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

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

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

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

a.s = g
a.t = n
a.u = j
a.p = j
a.q = f
l.y = c
n.x = f
n.v = g
n.r = g
g.p = n
g.q = a
k.w = a
f.p = n
f.q = a
c.y = l
j.y = l
assert c.y.y.y.y.y.y.y.txt == "l"