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

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

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

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

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

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

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

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

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

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

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

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

n.p = f
n.x = h
n.y = g
h.v = g
h.z = k
h.p = b
b.p = i
a.y = i
g.x = k
i.v = g
i.z = a
i.p = b
k.y = h
l.p = i
f.p = n
f.x = i
f.y = g
d.p = h
assert l.p.p.p.z.y.txt == "i"