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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: E = None
        self.p: E = None
        self.s: C = None
        self.w: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.z: F = None
        self.u: G = None
        self.x: G = None
        self.p: B = None
        self.q: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.p: F = None
        self.z: F = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: E = None
        self.p: E = None
        self.s: C = None
        self.w: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.z: F = None
        self.u: G = None
        self.x: G = None
        self.p: B = None
        self.q: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.p: F = None
        self.z: F = None
        self.txt = txt

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

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

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

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