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

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

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

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

i = A("i")
e = B("e")
d = C("d")
k = D("k")
l = A("l")
f = B("f")

i.p = f
i.v = d
i.u = d
i.r = k
e.x = d
e.z = d
e.v = k
e.r = f
d.t = k
k.y = e
k.z = e
l.p = e
l.v = d
l.u = d
l.r = k
f.x = d
f.z = d
f.v = k
f.r = e
assert k.z.z.t.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: C = None
        self.r: D = None
        self.u: C = None
        self.txt = txt

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

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

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

i = A("i")
e = B("e")
d = C("d")
k = D("k")
l = A("l")
f = B("f")

i.p = f
i.v = d
i.u = d
i.r = k
e.x = d
e.z = d
e.v = k
e.r = f
d.t = k
k.y = e
k.z = e
l.p = e
l.v = d
l.u = d
l.r = k
f.x = d
f.z = d
f.v = k
f.r = e
assert k.z.z.t.y.x.txt == "d"