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

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

class C:
    def __init__(self, txt: str):
        self.q: G = None
        self.r: H = None
        self.t: D = None
        self.x: A = None
        self.v: F = None
        self.o: G = None
        self.z: E = None
        self.txt = txt

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

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

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

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

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

j = A("j")
e = B("e")
n = C("n")
m = D("m")
i = E("i")
k = F("k")
g = G("g")
f = H("f")
d = A("d")
b = F("b")

j.o = k
j.u = e
e.q = i
e.x = i
e.u = m
n.q = g
n.o = g
n.r = f
n.t = m
n.x = d
n.v = b
n.z = i
m.x = f
i.o = k
k.p = g
g.z = e
g.t = e
g.r = e
g.y = i
g.v = f
f.x = j
d.o = k
d.u = e
b.p = g
assert g.v.x.o.p.r.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.u: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: G = None
        self.r: H = None
        self.t: D = None
        self.x: A = None
        self.v: F = None
        self.o: G = None
        self.z: E = None
        self.txt = txt

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

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

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

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

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

j = A("j")
e = B("e")
n = C("n")
m = D("m")
i = E("i")
k = F("k")
g = G("g")
f = H("f")
d = A("d")
b = F("b")

j.o = k
j.u = e
e.q = i
e.x = i
e.u = m
n.q = g
n.o = g
n.r = f
n.t = m
n.x = d
n.v = b
n.z = i
m.x = f
i.o = k
k.p = g
g.z = e
g.t = e
g.r = e
g.y = i
g.v = f
f.x = j
d.o = k
d.u = e
b.p = g
assert g.v.x.o.p.r.x.o.txt == "k"