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

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

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

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

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

k = A("k")
i = B("i")
n = C("n")
l = D("l")
j = E("j")
g = A("g")
d = B("d")
c = B("c")

k.p = n
i.p = l
i.z = l
i.r = k
n.y = l
l.t = n
j.u = n
j.w = n
j.p = l
j.y = d
j.v = d
g.p = n
d.p = l
d.z = l
d.r = g
c.p = l
c.z = l
c.r = k
assert d.z.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

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

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

k = A("k")
i = B("i")
n = C("n")
l = D("l")
j = E("j")
g = A("g")
d = B("d")
c = B("c")

k.p = n
i.p = l
i.z = l
i.r = k
n.y = l
l.t = n
j.u = n
j.w = n
j.p = l
j.y = d
j.v = d
g.p = n
d.p = l
d.z = l
d.r = g
c.p = l
c.z = l
c.r = k
assert d.z.t.y.txt == "l"