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

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

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

class D:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: G = None
        self.r: E = None
        self.z: F = None
        self.o: G = None
        self.y: D = None
        self.txt = txt

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

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

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

g.y = h
n.x = g
i.q = h
i.y = h
f.v = h
c.s = h
c.o = h
c.r = d
c.z = b
c.y = f
b.x = a
b.p = f
b.u = g
b.q = g
h.u = k
h.r = k
k.x = i
k.p = f
k.u = g
k.q = g
d.s = h
d.o = h
d.r = c
d.z = k
d.y = f
a.q = h
a.y = h
assert h.r.q.y.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: G = None
        self.r: E = None
        self.z: F = None
        self.o: G = None
        self.y: D = None
        self.txt = txt

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

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

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

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