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

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.z: E = None
        self.txt = txt

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

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

k = A("k")
b = B("b")
f = C("f")
n = D("n")
i = E("i")
d = E("d")

k.s = b
k.z = f
k.y = d
b.z = k
b.s = f
f.u = d
f.z = d
n.w = f
n.o = k
i.x = b
i.t = b
i.o = b
i.z = k
i.y = n
d.x = b
d.t = b
d.o = b
d.z = k
d.y = n
assert k.z.z.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: C = None
        self.y: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.z: E = None
        self.txt = txt

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

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

k = A("k")
b = B("b")
f = C("f")
n = D("n")
i = E("i")
d = E("d")

k.s = b
k.z = f
k.y = d
b.z = k
b.s = f
f.u = d
f.z = d
n.w = f
n.o = k
i.x = b
i.t = b
i.o = b
i.z = k
i.y = n
d.x = b
d.t = b
d.o = b
d.z = k
d.y = n
assert k.z.z.z.y.txt == "d"