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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

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

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