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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: B = None
        self.w: C = None
        self.txt = txt

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

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

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

c.s = i
n.w = k
n.r = f
n.z = l
n.s = l
n.v = j
g.p = l
g.x = l
g.w = k
j.y = f
h.r = n
h.w = e
e.r = n
e.w = h
i.s = c
f.s = c
k.p = l
k.x = n
k.w = g
l.w = g
l.r = f
l.z = n
l.s = n
l.v = j
assert f.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.w: C = None
        self.r: A = None
        self.z: B = None
        self.s: B = None
        self.v: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: B = None
        self.w: C = None
        self.txt = txt

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

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

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

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