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

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

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: G = None
        self.p: E = None
        self.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.x: E = None
        self.v: G = None
        self.r: E = None
        self.z: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: H = None
        self.p: C = None
        self.u: D = None
        self.v: I = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.y: C = None
        self.z: H = None
        self.r: H = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: G = None
        self.p: E = None
        self.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.x: E = None
        self.v: G = None
        self.r: E = None
        self.z: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: H = None
        self.p: C = None
        self.u: D = None
        self.v: I = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.y: C = None
        self.z: H = None
        self.r: H = None
        self.w: D = None
        self.txt = txt

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

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

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

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