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

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

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

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

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

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

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

n.o = i
n.y = h
h.z = m
h.r = m
i.p = l
i.w = h
e.x = h
e.t = i
e.y = m
e.s = m
e.u = l
e.o = f
m.t = h
l.w = m
l.y = n
l.q = e
l.o = g
l.v = g
g.w = m
g.y = n
g.q = e
g.o = l
g.v = l
f.p = l
f.w = h
assert g.q.t.p.w.t.r.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.y: B = None
        self.txt = txt

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

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

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

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

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

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

n.o = i
n.y = h
h.z = m
h.r = m
i.p = l
i.w = h
e.x = h
e.t = i
e.y = m
e.s = m
e.u = l
e.o = f
m.t = h
l.w = m
l.y = n
l.q = e
l.o = g
l.v = g
g.w = m
g.y = n
g.q = e
g.o = l
g.v = l
f.p = l
f.w = h
assert g.q.t.p.w.t.r.t.r.txt == "m"