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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: A = None
        self.w: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: F = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.p: A = None
        self.r: B = None
        self.w: F = None
        self.txt = txt

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

e.q = l
a.z = b
a.q = b
a.o = b
a.v = g
a.x = k
k.u = g
k.q = e
k.r = a
b.x = k
l.z = a
j.y = e
j.o = e
j.w = a
g.p = b
g.w = j
n.s = g
n.y = j
h.p = e
h.r = a
h.w = j
m.s = g
m.y = j
assert b.x.q.q.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: A = None
        self.w: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: F = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.p: A = None
        self.r: B = None
        self.w: F = None
        self.txt = txt

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

e.q = l
a.z = b
a.q = b
a.o = b
a.v = g
a.x = k
k.u = g
k.q = e
k.r = a
b.x = k
l.z = a
j.y = e
j.o = e
j.w = a
g.p = b
g.w = j
n.s = g
n.y = j
h.p = e
h.r = a
h.w = j
m.s = g
m.y = j
assert b.x.q.q.z.x.txt == "k"