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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

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

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

b = A("b")
n = B("n")
g = C("g")
j = D("j")
h = E("h")
k = F("k")
l = G("l")
c = C("c")
a = G("a")
e = F("e")

b.o = a
b.r = h
n.r = g
g.s = c
g.u = e
j.s = n
j.o = b
h.s = e
h.t = a
k.u = g
k.v = n
k.x = n
l.s = c
l.v = e
l.o = j
c.s = g
c.u = k
a.s = g
a.v = e
a.o = j
e.u = c
e.v = n
e.x = n
assert g.s.s.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: G = None
        self.r: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

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

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

b = A("b")
n = B("n")
g = C("g")
j = D("j")
h = E("h")
k = F("k")
l = G("l")
c = C("c")
a = G("a")
e = F("e")

b.o = a
b.r = h
n.r = g
g.s = c
g.u = e
j.s = n
j.o = b
h.s = e
h.t = a
k.u = g
k.v = n
k.x = n
l.s = c
l.v = e
l.o = j
c.s = g
c.u = k
a.s = g
a.v = e
a.o = j
e.u = c
e.v = n
e.x = n
assert g.s.s.u.u.u.u.txt == "g"