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

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

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

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

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

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

k.s = b
k.v = i
g.t = n
g.v = n
g.r = c
n.w = c
n.v = b
c.t = k
c.y = k
d.t = g
a.t = b
b.t = n
b.v = n
b.r = c
f.s = g
f.v = b
l.t = g
i.t = n
i.v = n
i.r = c
assert k.v.r.y.v.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.v: B = None
        self.txt = txt

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

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

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

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

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

k.s = b
k.v = i
g.t = n
g.v = n
g.r = c
n.w = c
n.v = b
c.t = k
c.y = k
d.t = g
a.t = b
b.t = n
b.v = n
b.r = c
f.s = g
f.v = b
l.t = g
i.t = n
i.v = n
i.r = c
assert k.v.r.y.v.v.v.v.v.txt == "b"