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

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.u: D = None
        self.x: C = None
        self.z: C = None
        self.o: C = None
        self.txt = txt

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

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

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

k = A("k")
h = B("h")
d = C("d")
e = D("e")
f = E("f")

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

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.u: D = None
        self.x: C = None
        self.z: C = None
        self.o: C = None
        self.txt = txt

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

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

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

k = A("k")
h = B("h")
d = C("d")
e = D("e")
f = E("f")

k.s = e
h.v = e
h.u = e
h.x = d
h.z = d
h.o = d
d.u = h
d.y = e
d.t = k
e.t = k
f.t = d
f.p = d
f.v = h
assert f.p.u.z.u.z.txt == "d"