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

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

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

n = A("n")
k = B("k")
b = C("b")
e = B("e")
c = C("c")
g = B("g")
j = C("j")
i = C("i")
m = B("m")

n.x = k
n.t = k
k.w = i
k.p = n
b.y = e
b.s = g
b.x = g
e.w = c
e.p = n
c.y = g
c.s = k
c.x = k
g.w = b
g.p = n
j.y = k
j.s = k
j.x = g
i.y = g
i.s = g
i.x = e
m.w = j
m.p = n
assert j.x.p.x.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.t: B = None
        self.txt = txt

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

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

n = A("n")
k = B("k")
b = C("b")
e = B("e")
c = C("c")
g = B("g")
j = C("j")
i = C("i")
m = B("m")

n.x = k
n.t = k
k.w = i
k.p = n
b.y = e
b.s = g
b.x = g
e.w = c
e.p = n
c.y = g
c.s = k
c.x = k
g.w = b
g.p = n
j.y = k
j.s = k
j.x = g
i.y = g
i.s = g
i.x = e
m.w = j
m.p = n
assert j.x.p.x.p.x.txt == "k"