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

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

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

d = A("d")
h = B("h")
j = C("j")
b = A("b")
f = B("f")
n = B("n")
g = B("g")
m = C("m")
c = B("c")

d.z = m
d.w = f
d.t = b
h.o = b
h.y = b
h.z = c
j.q = c
j.z = m
j.w = b
b.z = m
b.w = c
b.t = d
f.o = b
f.y = d
f.z = h
n.o = b
n.y = b
n.z = f
g.o = b
g.y = b
g.z = n
m.q = h
m.z = j
m.w = b
c.o = d
c.y = d
c.z = n
assert d.t.z.w.z.q.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.w: B = None
        self.t: A = None
        self.txt = txt

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

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

d = A("d")
h = B("h")
j = C("j")
b = A("b")
f = B("f")
n = B("n")
g = B("g")
m = C("m")
c = B("c")

d.z = m
d.w = f
d.t = b
h.o = b
h.y = b
h.z = c
j.q = c
j.z = m
j.w = b
b.z = m
b.w = c
b.t = d
f.o = b
f.y = d
f.z = h
n.o = b
n.y = b
n.z = f
g.o = b
g.y = b
g.z = n
m.q = h
m.z = j
m.w = b
c.o = d
c.y = d
c.z = n
assert d.t.z.w.z.q.z.z.txt == "n"