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

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

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

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

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

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

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

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

g.p = h
g.u = l
j.s = n
j.t = l
m.u = i
n.v = i
n.t = m
n.x = g
n.q = l
d.p = g
d.u = h
l.o = n
i.t = m
i.v = d
i.o = e
i.u = l
h.v = i
h.t = m
h.x = g
h.q = l
e.t = m
e.v = d
e.o = i
e.u = l
assert g.u.o.q.o.t.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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

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

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

g.p = h
g.u = l
j.s = n
j.t = l
m.u = i
n.v = i
n.t = m
n.x = g
n.q = l
d.p = g
d.u = h
l.o = n
i.t = m
i.v = d
i.o = e
i.u = l
h.v = i
h.t = m
h.x = g
h.q = l
e.t = m
e.v = d
e.o = i
e.u = l
assert g.u.o.q.o.t.u.t.txt == "m"