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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: I = None
        self.s: F = None
        self.u: C = None
        self.w: H = None
        self.txt = txt

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

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

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

class I:
    def __init__(self, txt: str):
        self.q: F = None
        self.y: G = None
        self.z: G = None
        self.txt = txt

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

h.v = b
h.z = n
c.z = e
n.z = i
n.r = i
n.y = f
n.q = f
b.x = c
m.q = f
m.s = i
m.u = n
m.w = e
i.r = a
a.q = n
a.x = e
e.r = i
f.q = i
f.y = a
f.z = a
assert h.v.x.z.r.r.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: I = None
        self.s: F = None
        self.u: C = None
        self.w: H = None
        self.txt = txt

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

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

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

class I:
    def __init__(self, txt: str):
        self.q: F = None
        self.y: G = None
        self.z: G = None
        self.txt = txt

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

h.v = b
h.z = n
c.z = e
n.z = i
n.r = i
n.y = f
n.q = f
b.x = c
m.q = f
m.s = i
m.u = n
m.w = e
i.r = a
a.q = n
a.x = e
e.r = i
f.q = i
f.y = a
f.z = a
assert h.v.x.z.r.r.q.y.txt == "f"