class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: C = None
        self.x: D = None
        self.q: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.t: F = None
        self.s: F = None
        self.r: F = None
        self.q: D = None
        self.txt = txt

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

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

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

h = A("h")
m = B("m")
g = C("g")
i = D("i")
c = E("c")
d = F("d")
n = A("n")

h.s = i
h.x = i
h.v = g
h.q = d
m.u = d
m.y = d
m.v = g
g.o = c
g.t = d
g.s = d
g.r = d
g.q = i
i.t = d
i.u = d
i.x = d
i.q = m
i.s = m
c.o = h
d.s = i
n.s = i
n.x = i
n.v = g
n.q = d
assert m.v.q.s.u.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: C = None
        self.x: D = None
        self.q: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.t: F = None
        self.s: F = None
        self.r: F = None
        self.q: D = None
        self.txt = txt

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

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

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

h = A("h")
m = B("m")
g = C("g")
i = D("i")
c = E("c")
d = F("d")
n = A("n")

h.s = i
h.x = i
h.v = g
h.q = d
m.u = d
m.y = d
m.v = g
g.o = c
g.t = d
g.s = d
g.r = d
g.q = i
i.t = d
i.u = d
i.x = d
i.q = m
i.s = m
c.o = h
d.s = i
n.s = i
n.x = i
n.v = g
n.q = d
assert m.v.q.s.u.s.q.txt == "m"