class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: I = None
        self.q: H = None
        self.r: H = None
        self.x: F = None
        self.w: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.w: A = None
        self.u: E = None
        self.r: B = None
        self.z: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.s: C = None
        self.t: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: I = None
        self.q: H = None
        self.r: H = None
        self.x: F = None
        self.w: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.w: A = None
        self.u: E = None
        self.r: B = None
        self.z: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.s: C = None
        self.t: A = None
        self.txt = txt

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

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