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

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

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

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

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

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

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

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

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

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

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

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

k.x = l
f.y = n
f.z = n
f.s = i
f.o = c
b.y = f
b.s = i
c.w = i
c.v = l
a.r = c
a.v = b
a.x = g
n.y = f
n.z = f
n.s = i
n.o = c
l.w = k
l.v = c
g.y = n
g.s = i
i.x = l
assert n.y.y.o.v.w.x.v.txt == "c"