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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: I = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: B = None
        self.r: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: E = None
        self.w: E = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: I = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: B = None
        self.r: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: E = None
        self.w: E = None
        self.txt = txt

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

b.z = n
b.w = d
f.q = e
n.o = h
h.u = n
i.u = m
e.r = c
d.u = f
d.r = n
c.r = b
c.v = f
m.y = i
m.u = i
m.w = i
g.u = f
g.r = n
assert f.q.r.v.q.r.txt == "c"