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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: D = None
        self.r: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: F = None
        self.v: D = None
        self.p: G = None
        self.txt = txt

n = A("n")
e = B("e")
h = C("h")
a = D("a")
l = E("l")
m = F("m")
b = G("b")
g = G("g")
c = A("c")
f = C("f")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: D = None
        self.r: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: F = None
        self.v: D = None
        self.p: G = None
        self.txt = txt

n = A("n")
e = B("e")
h = C("h")
a = D("a")
l = E("l")
m = F("m")
b = G("b")
g = G("g")
c = A("c")
f = C("f")

n.x = e
n.w = h
n.s = c
e.r = f
h.z = f
a.p = h
a.q = h
a.w = f
l.w = g
l.o = e
m.t = e
m.o = a
m.r = n
b.u = e
b.q = m
b.v = a
b.p = g
g.u = e
g.q = m
g.v = a
g.p = b
c.x = e
c.w = h
c.s = n
f.z = h
assert h.z.z.z.z.z.z.z.z.z.txt == "f"