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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: E = None
        self.t: B = None
        self.y: C = None
        self.p: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: B = None
        self.txt = txt

m = A("m")
g = B("g")
c = C("c")
h = D("h")
a = E("a")
k = F("k")
n = C("n")
j = E("j")

m.q = j
g.x = k
c.v = n
c.o = n
c.s = g
h.s = m
h.p = c
a.s = m
a.v = j
a.t = g
a.y = n
a.p = k
k.q = h
k.y = g
n.v = c
n.o = c
n.s = g
j.s = m
j.v = a
j.t = g
j.y = c
j.p = k
assert n.v.s.x.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: E = None
        self.t: B = None
        self.y: C = None
        self.p: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: B = None
        self.txt = txt

m = A("m")
g = B("g")
c = C("c")
h = D("h")
a = E("a")
k = F("k")
n = C("n")
j = E("j")

m.q = j
g.x = k
c.v = n
c.o = n
c.s = g
h.s = m
h.p = c
a.s = m
a.v = j
a.t = g
a.y = n
a.p = k
k.q = h
k.y = g
n.v = c
n.o = c
n.s = g
j.s = m
j.v = a
j.t = g
j.y = c
j.p = k
assert n.v.s.x.q.p.txt == "c"