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

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

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

e = A("e")
n = B("n")
f = C("f")
g = B("g")
i = C("i")
m = C("m")
h = A("h")
c = C("c")
a = A("a")
j = A("j")

e.x = a
e.z = i
e.y = j
n.t = g
f.p = g
f.q = h
g.t = n
i.p = g
i.q = a
m.p = n
m.q = j
h.x = j
h.z = c
h.y = a
c.p = n
c.q = a
a.x = j
a.y = j
a.z = f
j.x = a
j.z = i
j.y = e
assert j.y.x.z.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: C = None
        self.y: A = None
        self.txt = txt

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

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

e = A("e")
n = B("n")
f = C("f")
g = B("g")
i = C("i")
m = C("m")
h = A("h")
c = C("c")
a = A("a")
j = A("j")

e.x = a
e.z = i
e.y = j
n.t = g
f.p = g
f.q = h
g.t = n
i.p = g
i.q = a
m.p = n
m.q = j
h.x = j
h.z = c
h.y = a
c.p = n
c.q = a
a.x = j
a.y = j
a.z = f
j.x = a
j.z = i
j.y = e
assert j.y.x.z.p.t.txt == "n"