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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: H = None
        self.t: B = None
        self.o: B = None
        self.y: F = None
        self.txt = txt

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

b = A("b")
k = B("k")
c = C("c")
d = D("d")
n = E("n")
j = F("j")
m = G("m")
e = H("e")
g = F("g")

b.s = m
b.y = c
k.o = d
c.t = k
c.x = b
c.p = d
c.u = e
d.q = g
n.w = d
j.t = d
j.q = c
m.r = e
m.t = k
m.o = k
m.y = j
e.w = c
e.t = m
e.x = d
g.t = d
g.q = c
assert n.w.q.q.x.s.r.w.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: G = None
        self.y: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: H = None
        self.t: B = None
        self.o: B = None
        self.y: F = None
        self.txt = txt

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

b = A("b")
k = B("k")
c = C("c")
d = D("d")
n = E("n")
j = F("j")
m = G("m")
e = H("e")
g = F("g")

b.s = m
b.y = c
k.o = d
c.t = k
c.x = b
c.p = d
c.u = e
d.q = g
n.w = d
j.t = d
j.q = c
m.r = e
m.t = k
m.o = k
m.y = j
e.w = c
e.t = m
e.x = d
g.t = d
g.q = c
assert n.w.q.q.x.s.r.w.x.y.txt == "c"