class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.y: C = None
        self.r: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: F = None
        self.p: B = None
        self.r: D = None
        self.w: H = None
        self.u: G = None
        self.t: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.p: G = None
        self.s: B = None
        self.w: C = None
        self.q: C = None
        self.x: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: G = None
        self.y: B = None
        self.r: G = None
        self.q: G = None
        self.s: C = None
        self.v: A = None
        self.w: H = None
        self.x: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: A = None
        self.s: A = None
        self.x: C = None
        self.z: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: A = None
        self.v: B = None
        self.u: A = None
        self.s: F = None
        self.w: A = None
        self.txt = txt

c = A("c")
b = B("b")
f = C("f")
m = D("m")
g = E("g")
h = F("h")
i = G("i")
d = H("d")

c.q = i
c.y = f
c.r = h
b.z = f
b.w = h
b.r = c
f.z = h
f.o = h
f.p = b
f.r = m
f.w = d
f.t = d
f.u = i
m.o = h
m.x = h
m.p = i
m.s = b
m.w = f
m.q = f
g.p = i
g.r = i
g.q = i
g.y = b
g.s = f
g.v = c
g.w = d
g.x = m
h.v = d
i.w = f
i.x = f
i.u = c
i.s = c
i.z = m
d.q = c
d.u = c
d.w = c
d.v = b
d.s = h
assert b.w.v.v.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.y: C = None
        self.r: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: F = None
        self.p: B = None
        self.r: D = None
        self.w: H = None
        self.u: G = None
        self.t: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.p: G = None
        self.s: B = None
        self.w: C = None
        self.q: C = None
        self.x: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: G = None
        self.y: B = None
        self.r: G = None
        self.q: G = None
        self.s: C = None
        self.v: A = None
        self.w: H = None
        self.x: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: A = None
        self.s: A = None
        self.x: C = None
        self.z: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: A = None
        self.v: B = None
        self.u: A = None
        self.s: F = None
        self.w: A = None
        self.txt = txt

c = A("c")
b = B("b")
f = C("f")
m = D("m")
g = E("g")
h = F("h")
i = G("i")
d = H("d")

c.q = i
c.y = f
c.r = h
b.z = f
b.w = h
b.r = c
f.z = h
f.o = h
f.p = b
f.r = m
f.w = d
f.t = d
f.u = i
m.o = h
m.x = h
m.p = i
m.s = b
m.w = f
m.q = f
g.p = i
g.r = i
g.q = i
g.y = b
g.s = f
g.v = c
g.w = d
g.x = m
h.v = d
i.w = f
i.x = f
i.u = c
i.s = c
i.z = m
d.q = c
d.u = c
d.w = c
d.v = b
d.s = h
assert b.w.v.v.w.v.txt == "d"