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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.q: E = None
        self.w: H = None
        self.p: G = None
        self.r: H = None
        self.t: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: D = None
        self.v: D = None
        self.z: E = None
        self.r: F = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.t: G = None
        self.r: E = None
        self.u: B = None
        self.p: D = None
        self.y: F = None
        self.q: G = None
        self.txt = txt

c = A("c")
d = B("d")
g = C("g")
l = D("l")
a = E("a")
h = F("h")
f = G("f")
n = H("n")
m = A("m")
j = D("j")

c.p = n
c.q = g
d.y = a
d.q = a
d.w = n
d.r = n
d.p = f
d.t = f
g.u = j
g.v = j
g.p = l
g.z = a
g.r = h
l.w = j
a.q = d
h.x = d
h.r = g
h.u = g
h.t = n
f.v = l
n.t = f
n.q = f
n.r = a
n.u = d
n.p = l
n.y = h
m.p = n
m.q = g
j.w = l
assert f.v.w.w.w.w.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: H = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.q: E = None
        self.w: H = None
        self.p: G = None
        self.r: H = None
        self.t: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: D = None
        self.v: D = None
        self.z: E = None
        self.r: F = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.t: G = None
        self.r: E = None
        self.u: B = None
        self.p: D = None
        self.y: F = None
        self.q: G = None
        self.txt = txt

c = A("c")
d = B("d")
g = C("g")
l = D("l")
a = E("a")
h = F("h")
f = G("f")
n = H("n")
m = A("m")
j = D("j")

c.p = n
c.q = g
d.y = a
d.q = a
d.w = n
d.r = n
d.p = f
d.t = f
g.u = j
g.v = j
g.p = l
g.z = a
g.r = h
l.w = j
a.q = d
h.x = d
h.r = g
h.u = g
h.t = n
f.v = l
n.t = f
n.q = f
n.r = a
n.u = d
n.p = l
n.y = h
m.p = n
m.q = g
j.w = l
assert f.v.w.w.w.w.w.w.w.w.txt == "l"