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

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

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

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

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

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

k.p = c
k.x = i
g.w = i
g.s = e
g.y = e
c.x = k
c.v = k
e.p = j
e.v = k
l.q = k
l.z = e
l.x = c
j.q = k
j.z = e
j.x = c
i.q = k
i.z = e
i.x = c
assert k.p.x.x.z.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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

k.p = c
k.x = i
g.w = i
g.s = e
g.y = e
c.x = k
c.v = k
e.p = j
e.v = k
l.q = k
l.z = e
l.x = c
j.q = k
j.z = e
j.x = c
i.q = k
i.z = e
i.x = c
assert k.p.x.x.z.p.q.txt == "k"