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

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

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

n = A("n")
m = B("m")
j = C("j")
k = B("k")
f = C("f")
d = A("d")
b = B("b")
a = A("a")

n.y = j
n.t = m
m.u = d
m.w = k
m.t = j
j.w = d
j.t = f
j.p = f
k.u = n
k.w = b
k.t = j
f.w = d
f.t = j
f.p = j
d.y = f
d.t = b
b.u = n
b.w = k
b.t = j
a.y = f
a.t = m
assert k.w.t.w.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: B = None
        self.txt = txt

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

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

n = A("n")
m = B("m")
j = C("j")
k = B("k")
f = C("f")
d = A("d")
b = B("b")
a = A("a")

n.y = j
n.t = m
m.u = d
m.w = k
m.t = j
j.w = d
j.t = f
j.p = f
k.u = n
k.w = b
k.t = j
f.w = d
f.t = j
f.p = j
d.y = f
d.t = b
b.u = n
b.w = k
b.t = j
a.y = f
a.t = m
assert k.w.t.w.y.t.txt == "j"