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

class B:
    def __init__(self, txt: str):
        self.u: G = None
        self.z: C = None
        self.x: I = None
        self.o: D = None
        self.w: F = None
        self.v: H = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: H = None
        self.z: H = None
        self.txt = txt

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

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

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

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

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

i.s = m
i.v = f
i.o = d
h.u = f
h.z = n
h.x = k
h.o = c
h.w = d
h.v = m
n.y = a
c.y = g
a.s = n
a.u = m
a.z = m
d.x = m
g.w = n
m.q = i
m.x = i
m.v = d
k.q = h
f.w = n
assert d.x.v.x.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.s: H = None
        self.v: G = None
        self.o: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: G = None
        self.z: C = None
        self.x: I = None
        self.o: D = None
        self.w: F = None
        self.v: H = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: H = None
        self.z: H = None
        self.txt = txt

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

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

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

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

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

i.s = m
i.v = f
i.o = d
h.u = f
h.z = n
h.x = k
h.o = c
h.w = d
h.v = m
n.y = a
c.y = g
a.s = n
a.u = m
a.z = m
d.x = m
g.w = n
m.q = i
m.x = i
m.v = d
k.q = h
f.w = n
assert d.x.v.x.q.v.txt == "f"