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

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

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

e = A("e")
j = B("j")
i = C("i")
n = A("n")
k = B("k")
a = C("a")
m = C("m")

e.t = n
e.w = n
j.r = a
j.y = e
j.z = e
i.o = e
i.u = m
i.x = j
n.t = e
n.w = e
k.r = m
k.y = e
k.z = e
a.o = n
a.u = i
a.x = j
m.o = n
m.u = i
m.x = k
assert n.w.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.w: A = None
        self.txt = txt

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

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

e = A("e")
j = B("j")
i = C("i")
n = A("n")
k = B("k")
a = C("a")
m = C("m")

e.t = n
e.w = n
j.r = a
j.y = e
j.z = e
i.o = e
i.u = m
i.x = j
n.t = e
n.w = e
k.r = m
k.y = e
k.z = e
a.o = n
a.u = i
a.x = j
m.o = n
m.u = i
m.x = k
assert n.w.t.t.t.txt == "n"