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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: C = 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.s: A = None
        self.q: A = None
        self.w: B = None
        self.x: E = None
        self.o: A = None
        self.u: F = None
        self.v: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.v: F = None
        self.o: G = None
        self.x: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.u: E = None
        self.s: D = None
        self.q: B = None
        self.txt = txt

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

m = A("m")
h = B("h")
k = C("k")
f = D("f")
l = E("l")
c = F("c")
j = G("j")
g = A("g")
d = E("d")

m.o = j
m.u = g
h.t = g
h.u = k
k.v = l
f.s = g
f.q = g
f.w = h
f.x = d
f.o = m
f.u = c
f.v = j
l.r = h
l.x = h
l.v = c
l.o = j
c.w = j
c.u = l
c.s = f
c.q = h
j.o = g
j.x = h
g.o = j
g.u = m
d.r = h
d.x = h
d.v = c
d.o = j
assert k.v.v.w.o.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: G = None
        self.u: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: C = 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.s: A = None
        self.q: A = None
        self.w: B = None
        self.x: E = None
        self.o: A = None
        self.u: F = None
        self.v: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.v: F = None
        self.o: G = None
        self.x: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.u: E = None
        self.s: D = None
        self.q: B = None
        self.txt = txt

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

m = A("m")
h = B("h")
k = C("k")
f = D("f")
l = E("l")
c = F("c")
j = G("j")
g = A("g")
d = E("d")

m.o = j
m.u = g
h.t = g
h.u = k
k.v = l
f.s = g
f.q = g
f.w = h
f.x = d
f.o = m
f.u = c
f.v = j
l.r = h
l.x = h
l.v = c
l.o = j
c.w = j
c.u = l
c.s = f
c.q = h
j.o = g
j.x = h
g.o = j
g.u = m
d.r = h
d.x = h
d.v = c
d.o = j
assert k.v.v.w.o.u.u.u.u.txt == "g"