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

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.v: C = None
        self.q: E = None
        self.t: C = None
        self.p: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: E = None
        self.txt = txt

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

k = A("k")
g = B("g")
h = C("h")
n = D("n")
l = E("l")
f = F("f")
e = G("e")

k.y = f
k.q = g
k.u = g
k.o = l
k.p = l
g.t = l
h.p = n
h.v = g
n.u = e
n.v = h
n.t = h
n.p = h
n.q = l
l.o = h
l.u = h
l.t = k
l.p = g
l.y = f
f.u = l
f.y = l
e.y = f
e.v = l
e.q = n
assert g.t.o.v.t.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: F = None
        self.q: B = None
        self.o: E = None
        self.u: B = None
        self.p: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.v: C = None
        self.q: E = None
        self.t: C = None
        self.p: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: E = None
        self.txt = txt

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

k = A("k")
g = B("g")
h = C("h")
n = D("n")
l = E("l")
f = F("f")
e = G("e")

k.y = f
k.q = g
k.u = g
k.o = l
k.p = l
g.t = l
h.p = n
h.v = g
n.u = e
n.v = h
n.t = h
n.p = h
n.q = l
l.o = h
l.u = h
l.t = k
l.p = g
l.y = f
f.u = l
f.y = l
e.y = f
e.v = l
e.q = n
assert g.t.o.v.t.t.q.txt == "g"