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

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: E = None
        self.v: F = None
        self.y: E = None
        self.u: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: B = None
        self.u: B = None
        self.y: H = None
        self.s: H = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: H = None
        self.txt = txt

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

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

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

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

g.u = k
g.x = k
g.r = b
i.o = g
i.x = b
i.y = b
i.v = a
i.u = k
k.o = g
k.z = i
k.u = i
k.y = c
k.s = c
n.r = a
n.z = a
b.p = c
a.x = d
a.s = d
a.w = n
a.p = n
d.y = b
c.w = i
c.r = i
c.q = b
c.z = b
c.x = b
assert k.s.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: E = None
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: E = None
        self.v: F = None
        self.y: E = None
        self.u: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: B = None
        self.u: B = None
        self.y: H = None
        self.s: H = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: H = None
        self.txt = txt

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

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

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

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

g.u = k
g.x = k
g.r = b
i.o = g
i.x = b
i.y = b
i.v = a
i.u = k
k.o = g
k.z = i
k.u = i
k.y = c
k.s = c
n.r = a
n.z = a
b.p = c
a.x = d
a.s = d
a.w = n
a.p = n
d.y = b
c.w = i
c.r = i
c.q = b
c.z = b
c.x = b
assert k.s.x.p.txt == "c"