class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: H = None
        self.y: H = None
        self.v: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.y: G = None
        self.w: D = None
        self.t: F = None
        self.u: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: H = None
        self.y: D = None
        self.o: C = None
        self.u: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: F = None
        self.txt = txt

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

g.r = m
g.x = c
g.y = c
g.v = h
m.q = g
n.q = d
h.z = j
h.t = g
h.u = m
j.p = e
j.t = e
j.y = d
j.w = h
j.u = m
e.t = g
d.w = c
d.y = h
d.o = n
d.u = j
c.r = h
c.v = e
assert d.o.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: H = None
        self.y: H = None
        self.v: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.y: G = None
        self.w: D = None
        self.t: F = None
        self.u: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: H = None
        self.y: D = None
        self.o: C = None
        self.u: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: F = None
        self.txt = txt

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

g.r = m
g.x = c
g.y = c
g.v = h
m.q = g
n.q = d
h.z = j
h.t = g
h.u = m
j.p = e
j.t = e
j.y = d
j.w = h
j.u = m
e.t = g
d.w = c
d.y = h
d.o = n
d.u = j
c.r = h
c.v = e
assert d.o.q.o.txt == "n"