class A:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: I = None
        self.o: H = None
        self.x: G = None
        self.s: C = None
        self.p: A = None
        self.u: B = None
        self.v: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: A = None
        self.r: A = None
        self.v: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: D = None
        self.q: F = None
        self.t: C = None
        self.r: F = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: F = None
        self.x: C = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.t: I = None
        self.o: H = None
        self.x: G = None
        self.s: C = None
        self.p: A = None
        self.u: B = None
        self.v: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: A = None
        self.r: A = None
        self.v: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: D = None
        self.q: F = None
        self.t: C = None
        self.r: F = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: F = None
        self.x: C = None
        self.txt = txt

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

f.t = c
n.p = f
n.u = f
n.q = m
d.t = c
e.t = h
e.o = m
e.x = c
e.s = d
e.p = f
e.u = n
e.v = n
i.p = n
i.t = f
l.z = m
l.x = f
c.u = f
c.t = f
c.r = f
c.v = i
m.y = e
m.q = l
m.r = l
m.t = d
h.s = e
h.v = l
h.x = d
assert n.p.t.v.t.txt == "f"