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

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: A = None
        self.q: G = None
        self.r: B = None
        self.o: A = None
        self.v: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.y: F = None
        self.o: C = None
        self.p: G = None
        self.txt = txt

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

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

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

b.s = g
b.x = g
b.p = k
b.u = i
b.v = f
k.w = i
f.t = b
f.p = g
g.p = c
g.v = c
g.y = b
g.o = b
g.q = a
g.r = k
d.s = i
d.y = i
d.o = f
d.p = a
i.p = b
i.s = c
i.w = h
a.w = k
a.q = k
a.y = c
a.s = c
a.p = b
c.p = g
c.v = g
c.y = b
c.o = b
c.q = a
c.r = k
h.t = b
h.p = c
assert k.w.s.r.w.p.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.x: D = None
        self.p: B = None
        self.u: F = None
        self.v: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: A = None
        self.q: G = None
        self.r: B = None
        self.o: A = None
        self.v: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.y: F = None
        self.o: C = None
        self.p: G = None
        self.txt = txt

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

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

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

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