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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.q: G = None
        self.r: F = None
        self.x: G = None
        self.txt = txt

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

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

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

j.v = i
j.s = m
j.o = a
g.q = a
g.o = h
a.p = i
m.u = i
m.t = i
m.v = g
c.w = j
c.q = f
c.r = i
c.x = h
i.p = m
f.t = h
f.u = c
f.r = j
h.t = f
h.u = c
h.r = j
assert g.q.p.p.v.o.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.s: D = None
        self.o: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.q: G = None
        self.r: F = None
        self.x: G = None
        self.txt = txt

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

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

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

j.v = i
j.s = m
j.o = a
g.q = a
g.o = h
a.p = i
m.u = i
m.t = i
m.v = g
c.w = j
c.q = f
c.r = i
c.x = h
i.p = m
f.t = h
f.u = c
f.r = j
h.t = f
h.u = c
h.r = j
assert g.q.p.p.v.o.t.t.txt == "h"