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

class B:
    def __init__(self, txt: str):
        self.u: H = None
        self.q: H = None
        self.w: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: B = None
        self.p: C = None
        self.u: G = None
        self.y: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: H = None
        self.r: E = None
        self.s: G = None
        self.z: E = None
        self.q: D = None
        self.y: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.u: H = None
        self.q: H = None
        self.w: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: B = None
        self.p: C = None
        self.u: G = None
        self.y: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: H = None
        self.r: E = None
        self.s: G = None
        self.z: E = None
        self.q: D = None
        self.y: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.txt = txt

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

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

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