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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: I = None
        self.q: D = None
        self.s: A = None
        self.t: E = None
        self.v: D = None
        self.u: H = None
        self.w: J = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.p: F = None
        self.x: J = None
        self.o: C = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.w: H = None
        self.z: C = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

g = A("g")
i = B("i")
f = C("f")
h = D("h")
j = E("j")
n = F("n")
d = G("d")
m = H("m")
l = I("l")
a = J("a")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: I = None
        self.q: D = None
        self.s: A = None
        self.t: E = None
        self.v: D = None
        self.u: H = None
        self.w: J = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.p: F = None
        self.x: J = None
        self.o: C = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.w: H = None
        self.z: C = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

g = A("g")
i = B("i")
f = C("f")
h = D("h")
j = E("j")
n = F("n")
d = G("d")
m = H("m")
l = I("l")
a = J("a")

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