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

class B:
    def __init__(self, txt: str):
        self.v: H = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.q: E = None
        self.t: G = None
        self.s: D = None
        self.x: G = None
        self.r: D = None
        self.v: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: B = None
        self.t: A = None
        self.txt = txt

g = A("g")
e = B("e")
d = C("d")
f = D("f")
c = E("c")
j = F("j")
n = G("n")
l = H("l")

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

class B:
    def __init__(self, txt: str):
        self.v: H = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.q: E = None
        self.t: G = None
        self.s: D = None
        self.x: G = None
        self.r: D = None
        self.v: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: B = None
        self.t: A = None
        self.txt = txt

g = A("g")
e = B("e")
d = C("d")
f = D("f")
c = E("c")
j = F("j")
n = G("n")
l = H("l")

g.q = d
e.v = l
d.v = e
d.w = n
d.y = g
f.u = g
f.x = c
c.u = d
c.t = l
j.u = d
j.q = c
j.v = c
j.t = n
j.x = n
j.s = f
j.r = f
n.v = d
n.o = c
l.q = g
l.t = g
l.y = e
assert g.q.w.v.y.q.w.o.txt == "c"