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

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

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

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

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

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

c.p = d
c.o = k
k.y = n
k.r = i
i.v = c
i.t = f
i.p = f
n.x = c
n.w = c
n.z = i
n.s = k
f.x = k
d.x = c
d.w = c
d.z = i
d.s = k
assert i.t.x.r.p.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.o: B = None
        self.txt = txt

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

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

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

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

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

c.p = d
c.o = k
k.y = n
k.r = i
i.v = c
i.t = f
i.p = f
n.x = c
n.w = c
n.z = i
n.s = k
f.x = k
d.x = c
d.w = c
d.z = i
d.s = k
assert i.t.x.r.p.x.y.txt == "n"