class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.s: C = None
        self.u: E = None
        self.x: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.v: H = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: B = None
        self.v: H = None
        self.t: H = None
        self.txt = txt

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

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

a.p = g
a.s = k
a.x = k
a.u = i
d.x = b
d.q = b
d.u = e
k.u = a
k.y = b
k.t = d
e.t = k
i.u = g
i.v = m
g.o = b
b.x = d
b.q = d
b.v = m
b.t = m
m.x = k
m.q = i
assert k.u.p.o.x.x.q.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.s: C = None
        self.u: E = None
        self.x: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.v: H = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: B = None
        self.v: H = None
        self.t: H = None
        self.txt = txt

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

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

a.p = g
a.s = k
a.x = k
a.u = i
d.x = b
d.q = b
d.u = e
k.u = a
k.y = b
k.t = d
e.t = k
i.u = g
i.v = m
g.o = b
b.x = d
b.q = d
b.v = m
b.t = m
m.x = k
m.q = i
assert k.u.p.o.x.x.q.x.q.txt == "d"