class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: B = 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.q: A = None
        self.z: E = None
        self.r: A = None
        self.u: I = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: D = None
        self.y: A = None
        self.p: A = None
        self.z: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.s: I = None
        self.o: B = None
        self.p: D = None
        self.y: H = None
        self.t: I = None
        self.v: F = None
        self.w: A = None
        self.z: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: D = None
        self.txt = txt

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

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

f.q = j
f.r = j
j.z = h
n.q = f
n.r = f
n.z = e
n.u = d
g.x = j
g.s = l
e.t = n
e.u = g
e.y = f
e.p = f
e.z = l
l.y = g
l.q = f
l.x = n
l.u = h
l.t = j
c.s = d
c.t = d
c.o = j
c.z = j
c.p = g
c.y = h
c.v = l
c.w = f
h.s = n
h.y = g
d.r = c
assert h.s.r.q.z.y.s.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: B = 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.q: A = None
        self.z: E = None
        self.r: A = None
        self.u: I = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: D = None
        self.y: A = None
        self.p: A = None
        self.z: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.s: I = None
        self.o: B = None
        self.p: D = None
        self.y: H = None
        self.t: I = None
        self.v: F = None
        self.w: A = None
        self.z: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: D = None
        self.txt = txt

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

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

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