class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: I = None
        self.p: H = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.z: E = None
        self.q: I = None
        self.w: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.q: I = None
        self.x: G = None
        self.r: D = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.w: F = None
        self.z: I = None
        self.y: I = None
        self.u: A = None
        self.x: A = None
        self.t: D = None
        self.txt = txt

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

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

a.s = h
a.x = i
a.p = m
h.x = g
h.p = g
h.r = c
c.x = i
c.r = a
g.y = n
g.z = l
g.q = i
g.w = h
l.s = a
l.q = i
l.x = b
l.r = g
n.z = h
n.p = h
n.v = a
n.t = a
b.r = i
m.w = n
m.z = i
m.y = i
m.u = a
m.x = a
m.t = g
i.p = b
assert a.x.p.r.p.r.p.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: I = None
        self.p: H = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.z: E = None
        self.q: I = None
        self.w: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.q: I = None
        self.x: G = None
        self.r: D = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.w: F = None
        self.z: I = None
        self.y: I = None
        self.u: A = None
        self.x: A = None
        self.t: D = None
        self.txt = txt

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

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

a.s = h
a.x = i
a.p = m
h.x = g
h.p = g
h.r = c
c.x = i
c.r = a
g.y = n
g.z = l
g.q = i
g.w = h
l.s = a
l.q = i
l.x = b
l.r = g
n.z = h
n.p = h
n.v = a
n.t = a
b.r = i
m.w = n
m.z = i
m.y = i
m.u = a
m.x = a
m.t = g
i.p = b
assert a.x.p.r.p.r.p.r.txt == "i"