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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: E = None
        self.o: A = None
        self.q: F = None
        self.x: B = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: F = None
        self.r: F = None
        self.t: A = None
        self.txt = txt

n = A("n")
j = B("j")
a = C("a")
c = D("c")
l = E("l")
b = F("b")
d = C("d")
h = F("h")
g = B("g")
e = D("e")

n.z = j
j.w = n
j.o = n
j.z = l
j.q = b
j.x = g
a.z = j
a.p = n
a.o = l
a.q = l
a.y = l
a.r = d
c.y = e
l.x = e
l.z = a
b.u = h
b.x = h
b.r = h
b.t = n
d.z = g
d.p = n
d.o = l
d.q = l
d.y = l
d.r = a
h.u = b
h.x = b
h.r = b
h.t = n
g.w = n
g.o = n
g.z = l
g.q = h
g.x = j
e.y = c
assert n.z.z.x.y.y.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: E = None
        self.o: A = None
        self.q: F = None
        self.x: B = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: F = None
        self.r: F = None
        self.t: A = None
        self.txt = txt

n = A("n")
j = B("j")
a = C("a")
c = D("c")
l = E("l")
b = F("b")
d = C("d")
h = F("h")
g = B("g")
e = D("e")

n.z = j
j.w = n
j.o = n
j.z = l
j.q = b
j.x = g
a.z = j
a.p = n
a.o = l
a.q = l
a.y = l
a.r = d
c.y = e
l.x = e
l.z = a
b.u = h
b.x = h
b.r = h
b.t = n
d.z = g
d.p = n
d.o = l
d.q = l
d.y = l
d.r = a
h.u = b
h.x = b
h.r = b
h.t = n
g.w = n
g.o = n
g.z = l
g.q = h
g.x = j
e.y = c
assert n.z.z.x.y.y.y.y.y.y.y.txt == "c"