class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.q: D = None
        self.t: G = None
        self.y: A = None
        self.r: E = None
        self.o: C = None
        self.txt = txt

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

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

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

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

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

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

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

n.v = e
n.q = c
n.t = a
n.y = h
n.r = f
n.o = m
e.s = i
e.v = f
m.o = e
c.r = e
c.t = m
f.x = a
f.y = a
f.q = c
f.v = e
i.v = n
a.p = c
a.q = n
h.v = e
h.q = c
h.t = a
h.y = n
h.r = f
h.o = m
assert h.y.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.q: D = None
        self.t: G = None
        self.y: A = None
        self.r: E = None
        self.o: C = None
        self.txt = txt

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

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

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

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

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

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

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

n.v = e
n.q = c
n.t = a
n.y = h
n.r = f
n.o = m
e.s = i
e.v = f
m.o = e
c.r = e
c.t = m
f.x = a
f.y = a
f.q = c
f.v = e
i.v = n
a.p = c
a.q = n
h.v = e
h.q = c
h.t = a
h.y = n
h.r = f
h.o = m
assert h.y.o.o.txt == "e"