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

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: C = None
        self.z: C = None
        self.v: C = None
        self.p: F = None
        self.o: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.u: D = None
        self.r: G = None
        self.x: A = None
        self.z: D = None
        self.q: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: E = None
        self.r: F = None
        self.z: E = None
        self.p: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: C = None
        self.z: C = None
        self.v: C = None
        self.p: F = None
        self.o: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.u: D = None
        self.r: G = None
        self.x: A = None
        self.z: D = None
        self.q: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: E = None
        self.r: F = None
        self.z: E = None
        self.p: A = None
        self.txt = txt

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

g.u = d
g.v = d
g.x = k
g.o = e
h.x = g
h.w = k
h.z = k
h.v = k
h.p = i
h.o = b
k.s = g
e.u = h
d.u = k
d.p = h
d.x = g
i.s = b
i.r = b
i.u = e
i.z = e
i.x = g
i.q = h
b.x = d
b.z = d
b.r = i
b.p = g
assert b.r.s.p.o.u.o.txt == "b"