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

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

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

k = A("k")
a = B("a")
n = C("n")
e = A("e")
g = C("g")
c = A("c")
j = A("j")
i = A("i")
d = A("d")

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

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

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

k = A("k")
a = B("a")
n = C("n")
e = A("e")
g = C("g")
c = A("c")
j = A("j")
i = A("i")
d = A("d")

k.x = n
k.p = d
k.s = e
a.w = j
a.z = e
a.v = g
n.t = d
n.x = g
n.y = a
e.x = g
e.p = k
e.s = j
g.t = e
g.x = n
g.y = a
c.x = g
c.p = k
c.s = j
j.x = g
j.p = e
j.s = k
i.x = n
i.p = e
i.s = c
d.x = g
d.p = e
d.s = e
assert k.x.x.y.w.txt == "j"