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

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

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

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

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

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

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

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

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

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

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

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

n.y = h
n.p = h
h.s = b
i.y = d
i.z = d
i.x = h
i.s = n
f.v = n
f.o = b
b.u = d
d.u = k
k.u = d
assert i.z.u.u.u.u.txt == "d"