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

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

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

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

i.o = h
i.w = h
i.y = j
m.r = i
m.o = i
m.q = a
a.t = i
a.z = n
j.r = h
j.o = h
j.q = a
h.o = i
h.w = i
h.y = m
n.o = i
n.w = h
n.y = j
assert j.r.w.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: A = None
        self.y: B = None
        self.txt = txt

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

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

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

i.o = h
i.w = h
i.y = j
m.r = i
m.o = i
m.q = a
a.t = i
a.z = n
j.r = h
j.o = h
j.q = a
h.o = i
h.w = i
h.y = m
n.o = i
n.w = h
n.y = j
assert j.r.w.w.y.txt == "m"