class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.t: E = None
        self.v: D = None
        self.o: A = None
        self.r: F = None
        self.q: B = None
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.o: E = None
        self.x: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: G = None
        self.txt = txt

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

k = A("k")
i = B("i")
m = C("m")
j = D("j")
g = E("g")
f = F("f")
h = G("h")
e = E("e")

k.q = j
k.o = i
i.z = f
m.w = i
m.q = i
m.t = e
m.s = e
m.v = j
m.o = k
m.r = f
j.w = f
j.o = e
j.x = k
g.o = j
g.r = h
f.q = k
f.z = h
h.w = j
h.q = m
e.o = j
e.r = h
assert j.w.q.q.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.t: E = None
        self.v: D = None
        self.o: A = None
        self.r: F = None
        self.q: B = None
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.o: E = None
        self.x: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: G = None
        self.txt = txt

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

k = A("k")
i = B("i")
m = C("m")
j = D("j")
g = E("g")
f = F("f")
h = G("h")
e = E("e")

k.q = j
k.o = i
i.z = f
m.w = i
m.q = i
m.t = e
m.s = e
m.v = j
m.o = k
m.r = f
j.w = f
j.o = e
j.x = k
g.o = j
g.r = h
f.q = k
f.z = h
h.w = j
h.q = m
e.o = j
e.r = h
assert j.w.q.q.x.o.txt == "i"